From 5cf7e21fbc1819de7975b17f4b19cfdc3a057c1d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Apr 2006 12:41:51 -0700 Subject: [PATCH 1/6] stripspace: incomplete line fix (take #2) This fixes f4ee3eb68906f079dea45de4f1bbb03d68189eb3 breakage, which added an extra trailing blank line after stripping trailing blank lines by mistake. Signed-off-by: Junio C Hamano --- stripspace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stripspace.c b/stripspace.c index dee1ef06ed..65a6346452 100644 --- a/stripspace.c +++ b/stripspace.c @@ -12,7 +12,9 @@ static int cleanup(char *line) { int len = strlen(line); - if (len > 1 && line[len-1] == '\n') { + if (len && line[len-1] == '\n') { + if (len == 1) + return 0; do { unsigned char c = line[len-2]; if (!isspace(c)) From e3a125a94d34d22a8ca53e84949a1bb38cd6e425 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Apr 2006 12:47:10 -0700 Subject: [PATCH 2/6] Retire git-log.sh (take #4) Noticed by Johannes. We do not install it anymore, but still have been shipping the source, which was crazy. Signed-off-by: Junio C Hamano --- git-log.sh | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100755 git-log.sh diff --git a/git-log.sh b/git-log.sh deleted file mode 100755 index c2ea71cf14..0000000000 --- a/git-log.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2005 Linus Torvalds -# - -USAGE='[--max-count=] [..] [--pretty=] [git-rev-list options]' -SUBDIRECTORY_OK='Yes' -. git-sh-setup - -revs=$(git-rev-parse --revs-only --no-flags --default HEAD "$@") || exit -[ "$revs" ] || { - die "No HEAD ref" -} -git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | -LESS=-S ${PAGER:-less} From e51c3b50063d52ecd209a6f9846570d660e6310c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Apr 2006 12:59:09 -0700 Subject: [PATCH 3/6] git-log documentation Signed-off-by: Junio C Hamano --- Documentation/git-log.txt | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index e995d1b74b..76cb894caa 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -12,11 +12,16 @@ SYNOPSIS DESCRIPTION ----------- -Shows the commit logs. This command internally invokes -'git-rev-list', and the command line options are passed to that -command. +Shows the commit logs. + +The command takes options applicable to the gitlink::git-rev-list[1] +command to control what is shown and how, and options applicable to +the gitlink::git-diff-tree[1] commands to control how the change +each commit introduces are shown. + +This manual page describes only the most frequently used +options. -This manual page describes only the most frequently used options. OPTIONS ------- @@ -29,6 +34,12 @@ OPTIONS ..:: Show only commits between the named two commits. +-p:: + Show the change the commit introduces in a patch form. + +...:: + Show only commits that affect the specified paths. + Examples -------- @@ -47,6 +58,11 @@ git log --since="2 weeks ago" -- gitk:: The "--" is necessary to avoid confusion with the *branch* named 'gitk' +git log -r --name-status release..test:: + + Show the commits that are in the "test" branch but not yet + in the "release" branch, along with the list of paths + each commit modifies. Author ------ From cad1ed953513c3ef099d524746bb737c2be7b701 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Apr 2006 15:54:51 -0700 Subject: [PATCH 4/6] "git cmd -h" for shell scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrappers that use sh-setup took --help but not -h. Noticed by Sébastien Pierre. Signed-off-by: Junio C Hamano --- git-sh-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 025ef2d5f6..d15747f1ed 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -30,7 +30,7 @@ $LONG_USAGE" fi case "$1" in - --h|--he|--hel|--help) + -h|--h|--he|--hel|--help) echo "$LONG_USAGE" exit esac From 40c2fe003ce2af3ec522f239be274fd1a27422f6 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 14 Apr 2006 21:20:51 -0700 Subject: [PATCH 5/6] Clean up trailing whitespace when pretty-printing commits Partly because we've messed up and now have some commits with trailing whitespace, but partly because this also just simplifies the code, let's remove trailing whitespace from the end when pretty-printing commits. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- commit.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/commit.c b/commit.c index c7bb8dba64..ca25574500 100644 --- a/commit.c +++ b/commit.c @@ -557,16 +557,11 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit if (fmt == CMIT_FMT_ONELINE) break; } - if (fmt == CMIT_FMT_ONELINE) { - /* We do not want the terminating newline */ - if (buf[offset - 1] == '\n') - offset--; - } - else { - /* Make sure there is an EOLN */ - if (buf[offset - 1] != '\n') - buf[offset++] = '\n'; - } + while (offset && isspace(buf[offset-1])) + offset--; + /* Make sure there is an EOLN for the non-oneline case */ + if (fmt != CMIT_FMT_ONELINE) + buf[offset++] = '\n'; buf[offset] = '\0'; return offset; } From 4e1dc640097d4e389f12bcf12f75cdf7e4ceae61 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Apr 2006 15:57:32 -0700 Subject: [PATCH 6/6] rev-list --bisect: limit list before bisecting. I noticed bisect does not work well without both good and bad. Running this script in git.git repository would give you quite different results: #!/bin/sh initial=e83c5163316f89bfbde7d9ab23ca2e25604af290 mid0=`git rev-list --bisect ^$initial --all` git rev-list $mid0 | wc -l git rev-list ^$mid0 --all | wc -l mid1=`git rev-list --bisect --all` git rev-list $mid1 | wc -l git rev-list ^$mid1 --all | wc -l The $initial commit is the very first commit you made. The first midpoint bisects things evenly as designed, but the latter does not. The reason I got interested in this was because I was wondering if something like the following would help people converting a huge repository from foreign SCM, or preparing a repository to be fetched over plain dumb HTTP only: #!/bin/sh N=4 P=.git/objects/pack bottom= while test 0 \< $N do N=$((N-1)) if test -z "$bottom" then newbottom=`git rev-list --bisect --all` else newbottom=`git rev-list --bisect ^$bottom --all` fi if test -z "$bottom" then rev_list="$newbottom" elif test 0 = $N then rev_list="^$bottom --all" else rev_list="^$bottom $newbottom" fi p=$(git rev-list --unpacked --objects $rev_list | git pack-objects $P/pack) git show-index <$P/pack-$p.idx | wc -l bottom=$newbottom done The idea is to pack older half of the history to one pack, then older half of the remaining history to another, to continue a few times, using finer granularity as we get closer to the tip. This may not matter, since for a truly huge history, running bisect number of times could be quite time consuming, and we might be better off running "git rev-list --all" once into a temporary file, and manually pick cut-off points from the resulting list of commits. After all we are talking about "approximately half" for such an usage, and older history does not matter much. Signed-off-by: Junio C Hamano --- rev-list.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rev-list.c b/rev-list.c index 963707a495..cb67b399fc 100644 --- a/rev-list.c +++ b/rev-list.c @@ -371,6 +371,8 @@ int main(int argc, const char **argv) save_commit_buffer = verbose_header; track_object_refs = 0; + if (bisect_list) + revs.limited = 1; prepare_revision_walk(&revs); if (revs.tree_objects)