Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes: > On Tue, 10 Apr 2007, Junio C Hamano wrote: >> >> Well, I was planning to apply this directly on 'master' after >> giving them another pass. > > Goodie. I gave them another pass myself, and noticed a small leak and a > stupid copy-paste problem, fixed thus.. Yeah, I noticed the first one but not the second. Thanks. > diff --git a/read-cache.c b/read-cache.c > index 8fe94cd..f458f50 100644 > --- a/read-cache.c > +++ b/read-cache.c > @@ -279,7 +279,7 @@ int base_name_compare(const char *name1, int len1, int mode1, > c2 = name2[len]; > if (!c1 && (S_ISDIR(mode1) || S_ISDIRLNK(mode1))) > c1 = '/'; > - if (!c2 && (S_ISDIR(mode2) || S_ISDIRLNK(mode1))) > + if (!c2 && (S_ISDIR(mode2) || S_ISDIRLNK(mode2))) > c2 = '/'; > return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0; > } > diff --git a/refs.c b/refs.c > index 229da74..11a67a8 100644 > --- a/refs.c > +++ b/refs.c > @@ -229,6 +229,7 @@ static int resolve_gitlink_packed_ref(char *name, int pathlen, const char *refna > if (!f) > return -1; > read_packed_refs(f, &refs); > + fclose(f); > ref = refs.packed; > retval = -1; > while (ref) { By the way,... People occasionally ask "how would I make a small fix to a commit that is buried in the history", so let me take a moment to give them a recipe. Let's say while reviewing the code after applying all of the 6-series, you noticed the above thinko. First find out which commit caused it: $ git checkout lt/gitlink $ git blame -L229,+7 master.. -- refs.c b60108a1 (Linus Torvalds 2007-04-09 21:14:26 -0700 229) if (!f) b60108a1 (Linus Torvalds 2007-04-09 21:14:26 -0700 230) re.. b60108a1 (Linus Torvalds 2007-04-09 21:14:26 -0700 231) read_packe.. b60108a1 (Linus Torvalds 2007-04-09 21:14:26 -0700 232) ref = refs.. b60108a1 (Linus Torvalds 2007-04-09 21:14:26 -0700 233) retval = -.. b60108a1 (Linus Torvalds 2007-04-09 21:14:26 -0700 234) while (ref.. b60108a1 (Linus Torvalds 2007-04-09 21:14:26 -0700 235) if.. The commit to fix is b60108a1 (this is what I have in my private repo, and I'll be rebuilding the series with this example, so you will never see this commit object name in the end result I'll be pushing out). So I detach the HEAD at that commit and make a fix: $ git checkout b60108a1 $ edit refs.c $ git diff; # just to make sure $ git commit -a --amend At this point, the detached HEAD and the original branch look like this: $ git show-branch lt/gitlink HEAD ! [lt/gitlink] Teach core object handling functions about gitlinks * [HEAD] Add 'resolve_gitlink_ref()' helper function -- * [HEAD] Add 'resolve_gitlink_ref()' helper function + [lt/gitlink] Teach core object handling functions about gitlinks + [lt/gitlink^] Teach "fsck" not to follow subproject links + [lt/gitlink~2] Add "S_IFDIRLNK" file mode infrastructure for git links + [lt/gitlink~3] Add 'resolve_gitlink_ref()' helper function +* [HEAD^] Avoid overflowing name buffer in deep directory structures We fixed lt/gitlink~3 and the fixed-up commit is at HEAD. We want to rebase the rest of lt/gitlink on top of HEAD, like this: $ git rebase HEAD lt/gitlink This will take us back on lt/gitlink branch, set the tip of the branch to the commit we just made with the fix-up, and the first round will try to apply the change lt/gitlink~3 brings in on top of our HEAD. This _will_ fail, but that is to be expected, as we intend to replace that with what we just amended. Just reset it away and keep going. $ git reset --hard $ git rebase --skip Dealing with the other one in read-cache.c can be handled similarly after this. Luckily blame finds out that it is the last in the series (i.e. at the tip of lt/gitlink branch), so usual "fix the topmost commit" procedure applies. $ edit read-cache.c $ git diff ;# checking... $ git commit -a --amend - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html