Browse Source

Merge branches 'lt/show' and 'lt/revlist'

* lt/show:
  git-show

* lt/revlist:
  rev-parse lstat() workaround cleanup.
maint
Junio C Hamano 19 years ago
parent
commit
12db4852de
  1. 1
      .gitignore
  2. 5
      Makefile
  3. 18
      git-whatchanged.sh
  4. 16
      rev-parse.c

1
.gitignore vendored

@ -88,6 +88,7 @@ git-send-pack
git-sh-setup git-sh-setup
git-shell git-shell
git-shortlog git-shortlog
git-show
git-show-branch git-show-branch
git-show-index git-show-index
git-ssh-fetch git-ssh-fetch

5
Makefile

@ -125,7 +125,7 @@ SCRIPT_PYTHON = \
SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \
$(patsubst %.py,%,$(SCRIPT_PYTHON)) \ $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
git-cherry-pick git-cherry-pick git-show


# The ones that do not have to link with lcrypto nor lz. # The ones that do not have to link with lcrypto nor lz.
SIMPLE_PROGRAMS = \ SIMPLE_PROGRAMS = \
@ -440,6 +440,9 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
git-cherry-pick: git-revert git-cherry-pick: git-revert
cp $< $@ cp $< $@


git-show: git-whatchanged
cp $< $@

# These can record GIT_VERSION # These can record GIT_VERSION
git$X git.spec \ git$X git.spec \
$(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.sh,%,$(SCRIPT_SH)) \

18
git-whatchanged.sh

@ -5,14 +5,24 @@ SUBDIRECTORY_OK='Yes'
. git-sh-setup . git-sh-setup


diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@") || exit diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@") || exit
case "$0" in
*whatchanged)
count=
test -z "$diff_tree_flags" &&
diff_tree_flags=$(git-repo-config --get whatchanged.difftree)
diff_tree_default_flags='-M --abbrev' ;;
*show)
count=-n1
test -z "$diff_tree_flags" &&
diff_tree_flags=$(git-repo-config --get show.difftree)
diff_tree_default_flags='--cc --always' ;;
esac
test -z "$diff_tree_flags" && test -z "$diff_tree_flags" &&
diff_tree_flags=$(git-repo-config --get whatchanged.difftree) diff_tree_flags="$diff_tree_default_flags"
test -z "$diff_tree_flags" &&
diff_tree_flags='-M --abbrev'


rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") && rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") && diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&


eval "git-rev-list $rev_list_args" | eval "git-rev-list $count $rev_list_args" |
eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" | eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" |
LESS="$LESS -S" ${PAGER:-less} LESS="$LESS -S" ${PAGER:-less}

16
rev-parse.c

@ -150,11 +150,14 @@ static void show_datestring(const char *flag, const char *datestr)
show(buffer); show(buffer);
} }


static void show_file(const char *arg) static int show_file(const char *arg)
{ {
show_default(); show_default();
if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) {
show(arg); show(arg);
return 1;
}
return 0;
} }


int main(int argc, char **argv) int main(int argc, char **argv)
@ -329,14 +332,13 @@ int main(int argc, char **argv)
show_rev(REVERSED, sha1, arg+1); show_rev(REVERSED, sha1, arg+1);
continue; continue;
} }
as_is = 1;
if (!show_file(arg))
continue;
if (verify) if (verify)
die("Needed a single revision"); die("Needed a single revision");
if ((filter & DO_REVS) && if (lstat(arg, &st) < 0)
(filter & DO_NONFLAGS) && /* !def && */
lstat(arg, &st) < 0)
die("'%s': %s", arg, strerror(errno)); die("'%s': %s", arg, strerror(errno));
as_is = 1;
show_file(arg);
} }
show_default(); show_default();
if (verify && revs_count != 1) if (verify && revs_count != 1)

Loading…
Cancel
Save