Code

Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Mon, 12 Nov 2007 08:14:15 +0000 (00:14 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Nov 2007 08:14:15 +0000 (00:14 -0800)
* maint:
  for-each-ref: fix off by one read.
  git-branch: remove mention of non-existent '-b' option
  git-svn: prevent dcommitting if the index is dirty.
  Fix memory leak in traverse_commit_list

Documentation/git-branch.txt
builtin-for-each-ref.c
git-svn.perl
list-objects.c
t/t9106-git-svn-dcommit-clobber-series.sh

index 5e81aa4ee15af50bd47aa9b26ffd566328f3c35e..5ce905de862253aa2bd2ed619819306165e978f0 100644 (file)
@@ -105,7 +105,7 @@ OPTIONS
        '--track' were given.
 
 --no-track::
-       When -b is given and a branch is created off a remote branch,
+       When a branch is created off a remote branch,
        set up configuration so that git-pull will not retrieve data
        from the remote branch, ignoring the branch.autosetupmerge
        configuration variable.
index e909e66bedb168b7d10f6f0c3cd806d6ce139a2c..bfde2e2bbeffaed68b369b25cfe1b5ef4b108e12 100644 (file)
@@ -304,7 +304,7 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
                if (!eol)
                        return "";
                eol++;
-               if (eol[1] == '\n')
+               if (*eol == '\n')
                        return ""; /* end of header */
                buf = eol;
        }
index dd93e320a7c0d20e8eec1c171c9c96a32ced406b..1e244975abe1b41f10a784dc1e7869ee38efbfc3 100755 (executable)
@@ -390,6 +390,9 @@ sub cmd_set_tree {
 
 sub cmd_dcommit {
        my $head = shift;
+       git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
+               'Cannot dcommit with a dirty index.  Commit your changes first'
+               . "or stash them with `git stash'.\n";
        $head ||= 'HEAD';
        my @refs;
        my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
index e5c88c278fe23eefbf4cb4dd0c66251b208e48bd..4ef58e7ec01ebdfc6f036ccafaf837b2b38ed7a5 100644 (file)
@@ -170,4 +170,11 @@ void traverse_commit_list(struct rev_info *revs,
        }
        for (i = 0; i < objects.nr; i++)
                show_object(&objects.objects[i]);
+       free(objects.objects);
+       if (revs->pending.nr) {
+               free(revs->pending.objects);
+               revs->pending.nr = 0;
+               revs->pending.alloc = 0;
+               revs->pending.objects = NULL;
+       }
 }
index 7eff4cdc05635c85c354c9b2a96fe4844c682621..d59acc8d1ade041d01d5a45aa993b26919a0170c 100755 (executable)
@@ -53,4 +53,10 @@ test_expect_success 'change file but in unrelated area' "
                test x\"\`sed -n -e 61p < file\`\" = x6611
        "
 
+test_expect_failure 'attempt to dcommit with a dirty index' '
+       echo foo >>file &&
+       git add file &&
+       git svn dcommit
+'
+
 test_done