* Re: [PATCH 6/6] Retain caches of submodule refs
From: Michael Haggerty @ 2011-10-09 11:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt
In-Reply-To: <7v4o1hgemp.fsf@alter.siamese.dyndns.org>
On 08/17/2011 12:45 AM, Junio C Hamano wrote:
> All the changes except for this one made sense to me, but I am not sure
> about this one. How often do we look into different submodule refs in the
> same process over and over again?
I am having pangs of uncertainty about this patch.
Previous to this patch, the submodule reference cache was only used for
the duration of one call to do_for_each_ref(). (It was not *discarded*
until later, but the old cache was never reused.) Therefore, the
submodule reference cache was implicitly invalidated between successive
uses.
After this change, submodule ref caches are invalidated whenever
invalidate_cached_refs() is called. But this function is static, and it
is only called when main-module refs are changed.
AFAIK there is no way within refs.c to add, modify, or delete a
submodule reference. But if other code modifies submodule references
directly, then the submodule ref cache in refs.c would become stale.
Moreover, there is currently no API for invalidating the cache.
So I think I need help from a submodule guru (Heiko?) who can tell me
what is done with submodule references and whether they might be
modified while a git process is executing in the main module. If so,
then either this patch has to be withdrawn, or more work has to be put
in to make such code invalidate the submodule reference cache.
Sorry for the oversight, but I forgot that not all code necessarily uses
the refs.c API when dealing with references (a regrettable situation, BTW).
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: A Basic Git Question About File Tracking [ANSWERED]
From: Jakub Narebski @ 2011-10-09 9:37 UTC (permalink / raw)
To: Jon Forrest; +Cc: git, Jonathan Nieder
In-Reply-To: <4E910A14.7040801@gmail.com>
On Sun, 9 Oct 2011, Jon Forrest wrote:
> On 10/8/2011 6:17 PM, Jakub Narebski wrote:
>
> > You seem to be under [false] impression that git commit is about
> > _changes_ / _changeset_.
>
> This is correct. The Pro Git book says:
>
> "You stage these modified files and then commit
> all your staged changes"
>
> Plus, even "git status" tells me
>
> $ git status
> # On branch master
> # Changes to be committed:
Well, that is because the two representations: delta / changeset
("differential") representation and snapshot ("integral") representation
are related, and [in practice] one can be transformed into the other.
Sometimes it is better to think about commit as representing changeset
from parent commit, sometimes it is better to think of a commit as of
snapshot of a state of project.
But under the hood git model is snapshot-based.
> But I see my error. Below is what I hope is a clear
> explanation of what I didn't understand. It presumes
> that the reader understands the git objects model.
> Please let me know if anything is incorrect.
> ----------
> When you "git add" a file two things happen:
>
> 1) The file is copied to the git objects tree.
Actually it is file _contents_ that is copied to git object _store_.
> This location where the file is copied depends
> on the hash of the file's content.
I'd say that this is unnecessary implementation detail of "loose"
object format. I would say that _identifier_ of added object is
based on its contents.
>
> 2) An entry for the file is added to the git index.
> This entry includes the same hash that was mentioned
> in #1.
Yes.
> A tracked file has an entry in the git index file.
Yes.
> A copy of the file also exists in the objects tree.
A copy of a _contents_ of a file at specific point of time
exists in object _store_ (not necessary object tree, as it
can be packed).
> When you run 'git status', git computes the hash of
> every file in your working directory and looks
> up each file in the index. If the file isn't found
> then the file is shown as untracked.
Sidenote: git stores in the index also stats of a file (modification
time etc.) so it is possible to avoid recomputing the hash of every
file.
> When you do a commit, the hash values of everything
> in the index are copied into a tree object. The hash
> value of the tree object is then placed in a commit object.
True, though I would probably state it a bit differently.
> No copies of tracked files in the working directory are
> made at commit time. This is because the files were already
> copied into the objects tree when 'git add' was run.
> This is one reason why git commits are so fast.
Well, there is also "git commit -a", but it is true that git
copies into object store only those tracked files that changed.
Also I think that the main reason that git commits are fast is
that they are local operation, and not over the network as in the
case of centralized version control systems.
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH 6/6] revert: Simplify passing command-line arguments around
From: Jonathan Nieder @ 2011-10-09 9:24 UTC (permalink / raw)
To: Ramkumar Ramachandra
Cc: Tay Ray Chuan, Git List, Junio C Hamano, Jeff King,
Daniel Barkalow, Christian Couder
In-Reply-To: <CALkWK0niwg1Ogs+xBr8NHEce-MUUzPc_Upn0ZKRi3iCZ6fA4BQ@mail.gmail.com>
Ramkumar Ramachandra wrote:
> Jonathan Nieder writes:
>> Sorry I haven't had a chance to look over the patch yet. Is it
>> supposed to introduce a behavior change, does it prepare for some
>> future change, or is it just a cleanup?
>
> Prepare for some future change. See $gmane/179282 for original discussion.
Thanks, but I shouldn't have had to ask. Care to fix the commit
message? :)
^ permalink raw reply
* Re: [PATCH 6/6] revert: Simplify passing command-line arguments around
From: Ramkumar Ramachandra @ 2011-10-09 9:04 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Tay Ray Chuan, Git List, Junio C Hamano, Jeff King,
Daniel Barkalow, Christian Couder
In-Reply-To: <20111009085306.GA9209@elie.hsd1.il.comcast.net>
Hi Jonathan,
Jonathan Nieder writes:
> More important than the idiom is the intent. Presumably that intent
> was something like "I wrote the commit message, so if it makes you
> scratch your head, blame me, not Jonathan; and I made some other
> (minor) improvements, so consider blaming me even if it's the
> functional part that makes you scratch your head."
Exactly.
> Sorry I haven't had a chance to look over the patch yet. Is it
> supposed to introduce a behavior change, does it prepare for some
> future change, or is it just a cleanup?
Prepare for some future change. See $gmane/179282 for original discussion.
-- Ram
^ permalink raw reply
* [PATCH da/difftool-mergtool-refactor] Makefile: fix permissions of mergetools/ checked out with permissive umask
From: Jonathan Nieder @ 2011-10-09 9:17 UTC (permalink / raw)
To: David Aguilar
Cc: Junio C Hamano, git, Tanguy Ortolo, Charles Bailey,
Sebastian Schuberth
In-Reply-To: <1313652227-48545-4-git-send-email-davvid@gmail.com>
Ever since mergetool--lib was split into multiple files in
v1.7.7-rc0~3^2~1 (2011-08-18), the Makefile takes care to reset umask
and use tar --no-owner when installing merge tool definitions to
$(gitexecdir)/mergetools/. Unfortunately it does not take into
account the possibility that the permission bits of the files being
copied might already be wrong.
Rather than fixing the "tar" incantation and making it even more
complicated, let's just use the "install" utility. This only means
losing the ability to install executables and subdirectories of
mergetools/, which wasn't used.
Noticed by installing from a copy of git checked out with umask 002.
Compare v1.6.0.3~81^2 (Fix permission bits on sources checked out with
an overtight umask, 2008-08-21).
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
David Aguilar wrote:
> +++ b/Makefile
[...]
> @@ -2266,6 +2274,9 @@ install: all
> $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
> $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
> $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
> + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
> + (cd mergetools && $(TAR) cf - .) | \
> + (cd '$(DESTDIR_SQ)$(mergetools_instdir_SQ)' && umask 022 && $(TAR) xof -)
Last month I tried this out and found that, strangely, my files under
/usr/lib/git-core/mergetools/ had the g+w bit set. Leading me to
wonder: does the "umask" here have any effect at all?
Since debian/rules install is run as root, the default is for tar to
act as thought --preserve-permissions were passed, so the umask when
running "tar" is not relevant. Luckily I think "tar" is overkill
here, anyway.
Thoughts? Sorry to have taken so long to send this out.
Makefile | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 1e91b19c..e27755e7 100644
--- a/Makefile
+++ b/Makefile
@@ -2275,8 +2275,7 @@ install: all
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
- (cd mergetools && $(TAR) cf - .) | \
- (cd '$(DESTDIR_SQ)$(mergetools_instdir_SQ)' && umask 022 && $(TAR) xof -)
+ $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
ifndef NO_PERL
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
$(MAKE) -C gitweb install
--
1.7.7.rc1
^ permalink raw reply related
* Re: [PATCH 6/6] revert: Simplify passing command-line arguments around
From: Jonathan Nieder @ 2011-10-09 8:53 UTC (permalink / raw)
To: Ramkumar Ramachandra
Cc: Tay Ray Chuan, Git List, Junio C Hamano, Jeff King,
Daniel Barkalow, Christian Couder
In-Reply-To: <CALkWK0kA=zhpsmYhjMwv11xyHNhA0Ps=BjUDao0+HFLMKnADUg@mail.gmail.com>
Ramkumar Ramachandra wrote:
> Actually, I intended to put it in the commit message. Seems to be
> idiomatic: grep the log for "\[jc:" etc.
More important than the idiom is the intent. Presumably that intent
was something like "I wrote the commit message, so if it makes you
scratch your head, blame me, not Jonathan; and I made some other
(minor) improvements, so consider blaming me even if it's the
functional part that makes you scratch your head."
Sorry I haven't had a chance to look over the patch yet. Is it
supposed to introduce a behavior change, does it prepare for some
future change, or is it just a cleanup?
^ permalink raw reply
* Re: [PATCH 6/6] revert: Simplify passing command-line arguments around
From: Ramkumar Ramachandra @ 2011-10-09 8:28 UTC (permalink / raw)
To: Tay Ray Chuan
Cc: Git List, Jonathan Nieder, Junio C Hamano, Jeff King,
Daniel Barkalow, Christian Couder
In-Reply-To: <CALUzUxo=xN735+=Yz9eS_VSW3fpiTeng9s-66qM0Jno40-DPXQ@mail.gmail.com>
Hi Tay,
Tay Ray Chuan writes:
> On Sun, Oct 9, 2011 at 1:36 AM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
>> [rr: minor improvements, commit message]
>
> This "[]" could go below, under the 3-dash (but before the stat):
Actually, I intended to put it in the commit message. Seems to be
idiomatic: grep the log for "\[jc:" etc.
Thanks.
-- Ram
^ permalink raw reply
* Re: Recovering Committed Changes in a Detached Head?
From: Matthieu Moy @ 2011-10-09 8:12 UTC (permalink / raw)
To: Martin Fick; +Cc: SZEDER Gábor, Daly Gutierrez, git
In-Reply-To: <ab706826-75df-4410-941e-6b40ec92713c@email.android.com>
Martin Fick <mfick@codeaurora.org> writes:
>>git reflog to the rescue. For your example above it will output
>>something like this:
>>
>>deadbeef HEAD@{0}: checkout: moving from
>>92aa5381b9f7229523dba42aa94735c30f173451 to New_Branch
>> 92aa5381 HEAD@{1}: commit: Committing this in the Detached Head
>>3a5bb38a HEAD@{2}: checkout: moving from master to
>>3a5bb38a83c00f7acab573f0ec836577143200aa
>> deafbabe HEAD@{3}: ...
>> ...
>>
>>There you see the first line of the commit message from your "lost"
>>commit, and you can do
>>
>> git checkout -b lost_detached_head 92aa5381
>>
>>and you get a branch pointing to that commit you made while on
>>detached head, and you can work with it as usual.
>
> While rflog is cool, I can't help but think that git could be even more helpful for these scenarios.
Git has been showing a big scary warning when entering detached HEAD,
and now has another helpful one when leaving a commit orphan:
$ git checkout HEAD^
Note: checking out 'HEAD^'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at adcbd2f... foo
$ date > foo.txt; git add foo.txt; git commit -am "commited on detached HEAD"
[detached HEAD 9e9c4ef] commited on detached HEAD
1 files changed, 1 insertions(+), 1 deletions(-)
$ git checkout master
Warning: you are leaving 1 commit behind, not connected to
any of your branches:
9e9c4ef commited on detached HEAD
If you want to keep them by creating a new branch, this may be a good time
to do so with:
git branch new_branch_name 9e9c4efeca049ca559541595c9ca4a3380dee523
Switched to branch 'master'
(since 8e2dc6ac06ae90, Junio C Hamano, Fri Feb 18 16:04:47 2011, commit:
give final warning when reattaching HEAD to leave commits behind)
I think these warnings are (scary and big) enough.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* Re: Recovering Committed Changes in a Detached Head?
From: Ronan Keryell @ 2011-10-09 7:46 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <CACsJy8CsMCju7joj2B2xbBSTF1vHjyuFeSZyPhTJisO2sU-Fqg@mail.gmail.com>
>>>>> On Sun, 9 Oct 2011 16:52:11 +1100, Nguyen Thai Ngoc Duy <pclouds@gmail.com> said:
Nguyen> On Sun, Oct 9, 2011 at 9:00 AM, Martin Fick <mfick@codeaurora.org> wrote:
>> While rflog is cool, I can't help but think that git could be
>> even more helpful for these scenarios.
>> First, maybe git could create refs for these automatically,
>> perhaps with a name like orphans/1? Maybe these refs would only
>> be visible via git branch --orphans.
Nguyen> If I remember correctly, we don't have private ref
Nguyen> namespace, any refs created automatically this way could be
Nguyen> pushed out by accident.
A way to avoid this could be to deal with this like git-stash works,
instead of relying on the branch machinery.
But anyway, I think there is a trade-off between keeping some references
to some hypothetical future use and preventing the garbage collector to
reclaim useless objects...
--
Ronan KERYELL |\/ Phone: +1 408 844 HPC0
HPC Project, Inc. |/) Cell: +33 613 143 766
5201 Great America Parkway #3241 K Ronan.Keryell@hpc-project.com
Santa Clara, CA 95054 |\ skype:keryell
USA | \ http://hpc-project.com
^ permalink raw reply
* Re: Recovering Committed Changes in a Detached Head?
From: Nguyen Thai Ngoc Duy @ 2011-10-09 5:52 UTC (permalink / raw)
To: Martin Fick; +Cc: SZEDER Gábor, Daly Gutierrez, git
In-Reply-To: <ab706826-75df-4410-941e-6b40ec92713c@email.android.com>
On Sun, Oct 9, 2011 at 9:00 AM, Martin Fick <mfick@codeaurora.org> wrote:
>>git reflog to the rescue. For your example above it will output
>>something like this:
>>
>>deadbeef HEAD@{0}: checkout: moving from
>>92aa5381b9f7229523dba42aa94735c30f173451 to New_Branch
>> 92aa5381 HEAD@{1}: commit: Committing this in the Detached Head
>>3a5bb38a HEAD@{2}: checkout: moving from master to
>>3a5bb38a83c00f7acab573f0ec836577143200aa
>> deafbabe HEAD@{3}: ...
>> ...
>>
>>There you see the first line of the commit message from your "lost"
>>commit, and you can do
>>
>> git checkout -b lost_detached_head 92aa5381
>>
>>and you get a branch pointing to that commit you made while on
>>detached head, and you can work with it as usual.
>
> While rflog is cool, I can't help but think that git could be even more helpful for these scenarios.
>
> First, maybe git could create refs for these automatically, perhaps with a name like orphans/1? Maybe these refs would only be visible via git branch --orphans.
If I remember correctly, we don't have private ref namespace, any refs
created automatically this way could be pushed out by accident.
--
Duy
^ permalink raw reply
* Re: Git is not scalable with too many refs/*
From: Michael Haggerty @ 2011-10-09 5:43 UTC (permalink / raw)
To: Martin Fick
Cc: git, Christian Couder, Thomas Rast, René Scharfe,
Julian Phillips
In-Reply-To: <201110081459.52174.mfick@codeaurora.org>
[-- Attachment #1: Type: text/plain, Size: 2441 bytes --]
On 10/08/2011 10:59 PM, Martin Fick wrote:
> [...]
> So, with this in mind, I have discovered, that the fetch
> performance degradation by invalidating the caches in
> write_ref_sha1() is actually due to the packed-refs being
> reloaded and resorted again on each ref insertion (not the
> loose refs)!!!
Good point.
> I think that all of this might explain why no matter how
> good Michael's intentions are with his patch series, his
> series isn't likely to fix this problem
I never claimed that my patch fixes all use cases, or cures cancer
either :-) One step at a time.
> unless he does not
> invalidate the packed-refs after each insertion. I tried
> preventing this invalidation in his series to prove this,
> but unfortunately, it appears that in his series it is no
> longer possible to only invalidate just the packed-refs? :(
> Michael, I hope I am completely wrong about that...
Yes, you are completely wrong. I just implemented more selective cache
invalidation on top of the patch series.
I think your suggestion is safe because only non-symbolic references can
be stored in the packed refs; therefore the modification of a loose ref
can never affect the value of a packed ref. Of course a loose ref can
*hide* the value of a packed ref, but in such cases the packed ref is
never read anyway. And the *deletion* of a loose ref can expose a
previously-hidden packed ref, but this case is handled by delete_ref(),
which explicitly invalidates the packed-ref cache.
While I was at it, I also:
* In delete_ref(), only invalidate the packed reference cache if the
reference that is being deleted actually *is* among the packed references.
* Changed the code to stop invalidating the ref caches for submodules.
In the code paths where the cache invalidation was being done, only
main-module references were being changed. However, I'm not familiar
enough with submodules to know if/when submodule references *can* be
changed. It could be that the submodule reference caches have to be
invalidated under some circumstances; the current code might be buggy in
this area.
The changes are pushed to github. They don't make any significant
difference to my "refperf" results (attached), so perhaps a new
benchmark should be added. But I'm curious to see how they affect your
timings.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
[-- Attachment #2: refperf-summary.out --]
[-- Type: text/plain, Size: 5251 bytes --]
=================================== ======= ======= ======= ======= ======= ======= ======= ======= ======= =======
Test name [0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
=================================== ======= ======= ======= ======= ======= ======= ======= ======= ======= =======
branch-loose-cold 3.19 3.15 3.10 3.19 3.25 0.70 0.61 0.74 0.66 0.56
branch-loose-warm 0.19 0.19 0.20 0.19 0.19 0.00 0.00 0.00 0.00 0.00
for-each-ref-loose-cold 3.73 3.45 3.55 3.39 3.44 3.40 3.50 3.52 3.70 3.51
for-each-ref-loose-warm 0.44 0.44 0.44 0.43 0.43 0.43 0.43 0.43 0.43 0.43
checkout-loose-cold 3.35 3.23 3.23 3.15 3.29 0.65 0.71 0.76 0.66 0.69
checkout-loose-warm 0.19 0.19 0.20 0.18 0.19 0.01 0.01 0.01 0.01 0.00
checkout-orphan-loose 0.19 0.19 0.19 0.18 0.19 0.00 0.00 0.00 0.00 0.00
checkout-from-detached-loose-cold 7.80 4.17 4.17 4.05 4.09 4.07 4.26 4.23 4.18 4.08
checkout-from-detached-loose-warm 1.01 1.01 1.02 1.02 1.04 1.03 1.04 1.04 1.02 1.04
branch-contains-loose-cold 35.76 35.80 36.15 36.67 35.13 36.29 36.37 36.03 36.70 36.01
branch-contains-loose-warm 33.01 33.62 33.52 33.51 32.41 33.51 33.71 32.10 33.70 31.99
pack-refs-loose 4.19 4.20 4.25 4.21 4.20 4.21 4.20 4.19 4.24 4.21
branch-packed-cold 0.79 0.62 0.60 0.66 0.65 0.58 0.68 0.72 0.60 0.61
branch-packed-warm 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02
for-each-ref-packed-cold 0.96 0.97 0.97 0.93 0.89 0.92 0.98 0.96 0.92 0.96
for-each-ref-packed-warm 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.27 0.27 0.27
checkout-packed-cold 16.14 16.16 16.74 2.04 2.03 2.09 2.06 2.13 2.03 2.00
checkout-packed-warm 0.17 0.17 0.18 0.19 0.18 0.17 0.27 0.18 0.19 0.18
checkout-orphan-packed 0.02 0.01 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02
checkout-from-detached-packed-cold 16.24 15.96 16.80 1.99 2.06 2.01 2.08 2.10 1.97 1.96
checkout-from-detached-packed-warm 15.04 14.96 15.76 0.77 0.81 0.79 0.83 0.80 0.79 0.80
branch-contains-packed-cold 36.18 36.98 36.92 35.19 34.97 35.09 33.34 33.87 34.27 34.51
branch-contains-packed-warm 35.27 35.12 36.20 33.52 32.76 33.49 33.65 32.96 33.68 32.34
clone-loose-cold 9.09 9.22 9.15 9.10 9.19 9.03 9.09 9.25 8.96 9.03
clone-loose-warm 5.57 5.85 5.65 5.55 5.61 5.64 5.65 5.61 5.74 5.59
fetch-nothing-loose 1.43 1.43 1.44 1.44 1.45 1.45 1.46 1.44 1.44 1.44
pack-refs 0.08 0.08 0.08 0.08 0.09 0.08 0.09 0.08 0.08 0.08
fetch-nothing-packed 1.44 1.43 1.44 1.44 1.44 1.44 1.44 1.44 1.44 1.44
clone-packed-cold 1.35 1.26 1.30 1.32 1.28 1.35 1.38 1.35 1.29 1.21
clone-packed-warm 0.36 0.35 0.35 0.36 0.36 0.36 0.35 0.36 0.37 0.35
fetch-everything-cold 30.29 30.01 29.79 29.04 29.84 29.25 29.30 29.26 29.76 29.30
fetch-everything-warm 26.20 26.04 26.40 25.60 26.22 25.83 25.82 25.85 26.68 25.73
=================================== ======= ======= ======= ======= ======= ======= ======= ======= ======= =======
[0] f696543 (tag: v1.7.6) Git 1.7.6
[1] 703f05a (tag: v1.7.7) Git 1.7.7
[2] 27897d2 (origin/master) Merge remote-tracking branch 'gitster/mh/iterate-refs'
[3] 558b49c is_refname_available(): reimplement using do_for_each_ref_in_list()
[4] 1658397 Store references hierarchically
[5] 5f5a126 get_ref_dir(): add a recursive option
[6] a306af1 get_ref_dir(): read one whole directory before descending into subdirs
[7] fd53cf7 add_ref(): change to take a (struct ref_entry *) as second argument
[8] 9944c7f (origin/testing) read_packed_refs(): keep track of the directory being worked in
[9] cb75c57 (origin/ok, origin/hierarchical-refs, origin/HEAD) refs.c: call clear_cached_ref_cache() from repack_without_ref()
^ permalink raw reply
* Re: Recovering Committed Changes in a Detached Head?
From: Martin Fick @ 2011-10-09 5:39 UTC (permalink / raw)
To: Joel C. Salomon, git; +Cc: szeder, daly.gutierrez
In-Reply-To: <4E9115B0.3030701@gmail.com>
"Joel C. Salomon" <joelcsalomon@gmail.com> wrote:
>On 10/08/2011 06:00 PM, Martin Fick wrote:
>>> git reflog to the rescue.
><snip>
>>> There you see the first line of the commit message from your "lost"
>>> commit, and you can do
>>>
>>> git checkout -b lost_detached_head 92aa5381
>>>
>>> and you get a branch pointing to that commit you made while on
>>> detached head, and you can work with it as usual.
>>
>> While rflog is cool, I can't help but think that git could be even
>more helpful for these scenarios.
>>
>> First, maybe git could create refs for these automatically, perhaps
>with a name like orphans/1? Maybe these refs would only be visible via
>git branch --orphans.
>
>Creating these "orphan" refs would require the equivalent of (part of)
>git-fsck; I can't imagine that could be imposed without significant
>overhead on too many operations. I think you'd be better off wrapping
>git-fsck in a script that can create these branches.
Is there another way to create orphan refs than by doing a checkout and leaving the orphan behind? I guess a rebase or other branch rewinding operations, but shouldn't it already know on those that that if it alters anything, it will create an orphan? Git already checks for to see if it is leaving orphan refs behind on a checkout, why not just give the orphan a branch name at those points (not sure what to do if the check is bypassed with -q, just punt I guess)?
-Martin
Employee of Qualcomm Innovation Center,Inc. which is a member of Code Aurora Forum
^ permalink raw reply
* Re: Recovering Committed Changes in a Detached Head?
From: Joel C. Salomon @ 2011-10-09 3:32 UTC (permalink / raw)
To: git; +Cc: mfick, szeder, daly.gutierrez
In-Reply-To: <ab706826-75df-4410-941e-6b40ec92713c@email.android.com>
On 10/08/2011 06:00 PM, Martin Fick wrote:
>> git reflog to the rescue.
<snip>
>> There you see the first line of the commit message from your "lost"
>> commit, and you can do
>>
>> git checkout -b lost_detached_head 92aa5381
>>
>> and you get a branch pointing to that commit you made while on
>> detached head, and you can work with it as usual.
>
> While rflog is cool, I can't help but think that git could be even more helpful for these scenarios.
>
> First, maybe git could create refs for these automatically, perhaps with a name like orphans/1? Maybe these refs would only be visible via git branch --orphans.
Creating these "orphan" refs would require the equivalent of (part of)
git-fsck; I can't imagine that could be imposed without significant
overhead on too many operations. I think you'd be better off wrapping
git-fsck in a script that can create these branches.
--Joel
^ permalink raw reply
* Re: A Basic Git Question About File Tracking [ANSWERED]
From: Jon Forrest @ 2011-10-09 2:42 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <m3ipnz0xri.fsf@localhost.localdomain>
On 10/8/2011 6:17 PM, Jakub Narebski wrote:
> You seem to be under [false] impression that git commit is about
> _changes_ / _changeset_.
This is correct. The Pro Git book says:
"You stage these modified files and then commit
all your staged changes"
Plus, even "git status" tells me
$ git status
# On branch master
# Changes to be committed:
But I see my error. Below is what I hope is a clear
explanation of what I didn't understand. It presumes
that the reader understands the git objects model.
Please let me know if anything is incorrect.
----------
When you "git add" a file two things happen:
1) The file is copied to the git objects tree.
This location where the file is copied depends
on the hash of the file's content.
2) An entry for the file is added to the git index.
This entry includes the same hash that was mentioned
in #1.
A tracked file has an entry in the git index file.
A copy of the file also exists in the objects tree.
When you run 'git status', git computes the hash of
every file in your working directory and looks
up each file in the index. If the file isn't found
then the file is shown as untracked.
When you do a commit, the hash values of everything
in the index are copied into a tree object. The hash
value of the tree object is then placed in a commit object.
No copies of tracked files in the working directory are
made at commit time. This is because the files were already
copied into the objects tree when 'git add' was run.
This is one reason why git commits are so fast.
-----
How's that?
Thanks to everyone for sticking with me on this.
Jon
^ permalink raw reply
* Re: [PATCH 6/6] revert: Simplify passing command-line arguments around
From: Tay Ray Chuan @ 2011-10-09 2:14 UTC (permalink / raw)
To: Ramkumar Ramachandra
Cc: Git List, Jonathan Nieder, Junio C Hamano, Jeff King,
Daniel Barkalow, Christian Couder
In-Reply-To: <1318095407-26429-7-git-send-email-artagnon@gmail.com>
On Sun, Oct 9, 2011 at 1:36 AM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
> [snip]
> [rr: minor improvements, commit message]
This "[]" could go below, under the 3-dash (but before the stat):
> [snip]
> ---
> builtin/revert.c | 53 +++++++++++++++++++++++++++++------------------------
> 1 files changed, 29 insertions(+), 24 deletions(-)
--
Cheers,
Ray Chuan
^ permalink raw reply
* Re: A Basic Git Question About File Tracking
From: Jakub Narebski @ 2011-10-09 1:17 UTC (permalink / raw)
To: Jon Forrest; +Cc: git, Jonathan Nieder
In-Reply-To: <4E90E60C.7060105@gmail.com>
Jon Forrest <nobozo@gmail.com> writes:
> On 10/3/2011 6:22 PM, Jonathan Nieder wrote:
>
> [I'm just getting back to this question. I had accidentally
> sent this follow up directly to Jonathan but I want to
> continue this on the email list.]
>
> > Yes, "x" is tracked. Moreover, "x" is in the index. You can
> > list files in the index with the "git ls-files -s" command.
>
> This spoils my understanding of what the index
> is. I had been thinking that after you add files
> to the index, and then commit, the index is then
> empty. In other words, whatever's in the index
> gets committed, and then the index is cleaned.
>
> On the other hand, if the definition of a tracked
> file is a file that's in the index, then this definitely
> clears up my understanding of tracked files.
>
> If every file that's 'git add'ed stays in the
> index, how does git know which files to commit?
>
> I can't prove it but I suspect that many git beginners
> also are confused by this.
You seem to be under [false] impression that git commit is about
_changes_ / _changeset_.
It is not true. What is stored in git commit object is (pointer to)
_snapshot_ of a state of a project at given time. This means that
"git commit" creates a tree object out of state of the index, and
creates commit object that points to said newly created tree, and has
version you started work from as its parent. It is commit remember
the previous version that allows to turn commit into changeset.
Hopefully that would clear up your confusion.
--
Jakub Narębski
^ permalink raw reply
* Re: A Basic Git Question About File Tracking
From: Jon Forrest @ 2011-10-09 0:08 UTC (permalink / raw)
To: git
In-Reply-To: <20111004012244.GB13836@elie>
On 10/3/2011 6:22 PM, Jonathan Nieder wrote:
[I'm just getting back to this question. I had accidentally
sent this follow up directly to Jonathan but I want to
continue this on the email list.]
> Yes, "x" is tracked. Moreover, "x" is in the index. You can
> list files in the index with the "git ls-files -s" command.
This spoils my understanding of what the index
is. I had been thinking that after you add files
to the index, and then commit, the index is then
empty. In other words, whatever's in the index
gets committed, and then the index is cleaned.
On the other hand, if the definition of a tracked
file is a file that's in the index, then this definitely
clears up my understanding of tracked files.
If every file that's 'git add'ed stays in the
index, how does git know which files to commit?
I can't prove it but I suspect that many git beginners
also are confused by this.
Thanks for your replies.
Jon Forrest
^ permalink raw reply
* Re: [RFC/PATCH] Add multiple workdir support to branch/checkout
From: Julián Landerreche @ 2011-10-08 22:55 UTC (permalink / raw)
To: git
In-Reply-To: <1317786204-57335-1-git-send-email-jaysoffian@gmail.com>
Jay wrote:
> I guess it depends what you mostly use your workdirs for. For me, it's
> to have different branches checked out, not to have the same branch
> checked out in multiple locations.
I find those both use cases for workdirs to fit perfectly in my usual workflow
(web development).
- Different branches checked out
I've a cloned repo of a CMS and I use git-new-workdir to checkout different
branches and tags, so to have available a few workdirs of recent versions, which
I "attach" by symlinks to my web development projects.
- Same branch checked out in multiple locations
This use case just came up recently, when I find out that I prefer to have two
websites "attached" (via symlink) to two different workdirs of the same branch.
I could have "attached" both websites to the same workdir, but my idea of having
the websites "attached" to different workdirs was to be able to do some
development (i.e: to commit stuff) on one workdir, while keeping the other one
"fixed" at some particular commit.
Juno wrote:
> Careful. Git has survived without your patch series till now, as people
> learned to be careful when they use separate workdirs and avoid certain
> things, to the point that they are not necessarily aware that they are
> avoiding them (one good practice is to keep the HEADs of non-primary
> workdirs detached).
Jay wrote:
> Also, while I might recommend new-workdir to my coworkers with the
> advice "don't checkout the same branch in multiple workdirs", never in
> a million years would I say "use new-workdir, but make sure to only
> use a detached HEAD in the workdirs." The latter would make their
> actual HEADs explode.
After reading this, I noticed that using git-new-workdir with detached HEAD in
each workdir could fit my workflow very well. In some cases (the ones mentioned
above), I find that I may not need to have a workdir for a branch (where I won't
do work, so won't be committing there), but rather to have that workdir "fixed"
at a particular commit.
That being said, I also see that I would find useful to be able to
update/advance this workdir (in a detached HEAD state, that is, "fixed" at an
specific commit) to a newer commit or to a particular branch.
Bottom line: making git-new-workdir a more reliable & friendly tool that could
fit in the workflows of both advanced and non-advanced users.
-----
Quick note about me: I am an "advanced n00b" on git usage (using it since one
year ago), and a general non-advanced user (of git and git-new-workdir). In
other words, a git user that could easily shoot itself in the foot.
Arrived here while looking for some info about git-new-workdir, and if it was a
Bad Idea to have different workdirs of the same branch (ie. checkout the same
branch on different folders), as the idea of recklessly committing on different
workdirs for the same branch sounded like a recipe for disasters to me.
I find it git-new-workdir a really useful tool in my workflow, and prefer it
over having many clones of the same repo, which will imply having to do
configuration for remotes and push/pull operations, which are also mind-boggling
tasks for non-advanced users.
-----
Thanks for reading.
^ permalink raw reply
* Re: Recovering Committed Changes in a Detached Head?
From: Martin Fick @ 2011-10-08 22:00 UTC (permalink / raw)
To: SZEDER Gábor, Daly Gutierrez; +Cc: git
In-Reply-To: <20111008213741.GA24409@goldbirke>
>git reflog to the rescue. For your example above it will output
>something like this:
>
>deadbeef HEAD@{0}: checkout: moving from
>92aa5381b9f7229523dba42aa94735c30f173451 to New_Branch
> 92aa5381 HEAD@{1}: commit: Committing this in the Detached Head
>3a5bb38a HEAD@{2}: checkout: moving from master to
>3a5bb38a83c00f7acab573f0ec836577143200aa
> deafbabe HEAD@{3}: ...
> ...
>
>There you see the first line of the commit message from your "lost"
>commit, and you can do
>
> git checkout -b lost_detached_head 92aa5381
>
>and you get a branch pointing to that commit you made while on
>detached head, and you can work with it as usual.
While rflog is cool, I can't help but think that git could be even more helpful for these scenarios.
First, maybe git could create refs for these automatically, perhaps with a name like orphans/1? Maybe these refs would only be visible via git branch --orphans.
-Martin
Employee of Qualcomm Innovation Center,Inc. which is a member of Code Aurora Forum
^ permalink raw reply
* Re: Recovering Committed Changes in a Detached Head?
From: SZEDER Gábor @ 2011-10-08 21:37 UTC (permalink / raw)
To: Daly Gutierrez; +Cc: git
In-Reply-To: <1318107488.5865.46.camel@R0b0ty>
Hi,
On Sat, Oct 08, 2011 at 04:58:07PM -0400, Daly Gutierrez wrote:
> Is this possible after changing from the Detached Head branch to an
> existing branch? How about if I don't remember the commit SHA1 ID?
>
> What I did, to the best of my knowledge:
> 1) Checked out a previous version:
> > git checkout 3a5bb38a83c00f7acab573f0ec836577143200aa
>
> 2) Modified file and committed the changes in the detached branch.
> > git log
> commit 92aa5381b9f7229523dba42aa94735c30f173451
> Author: Daly Gutierrez <Daly.Gutierrez@gmail.com>
> Date: Sat Oct 8 16:20:11 2011 -0400
>
> Committing this in the Detached Head
>
> 3) For curiosity,
> > git branch
> * (no branch)
> New_Branch
> Second_New_Branch
> master
>
> 4) Changed to 'New_Branch' branch... I no longer see the detached
> branch...
> > git branch
> * New_Branch
> Second_New_Branch
> master
>
> 5) Want to access the file with the changes I made in the Detached
> branch, but don't know how... PLEASE HELP?
git reflog to the rescue. For your example above it will output
something like this:
deadbeef HEAD@{0}: checkout: moving from 92aa5381b9f7229523dba42aa94735c30f173451 to New_Branch
92aa5381 HEAD@{1}: commit: Committing this in the Detached Head
3a5bb38a HEAD@{2}: checkout: moving from master to 3a5bb38a83c00f7acab573f0ec836577143200aa
deafbabe HEAD@{3}: ...
...
There you see the first line of the commit message from your "lost"
commit, and you can do
git checkout -b lost_detached_head 92aa5381
and you get a branch pointing to that commit you made while on
detached head, and you can work with it as usual.
Best,
Gábor
^ permalink raw reply
* Re: Git is not scalable with too many refs/*
From: Martin Fick @ 2011-10-08 20:59 UTC (permalink / raw)
To: git
Cc: Christian Couder, Thomas Rast, René Scharfe, Julian Phillips,
Michael Haggerty
In-Reply-To: <201109301606.31748.mfick@codeaurora.org>
On Friday, September 30, 2011 04:06:31 pm Martin Fick wrote:
> On Friday, September 30, 2011 03:02:30 pm Martin Fick
wrote:
> > On Friday, September 30, 2011 10:41:13 am Martin Fick
>
> wrote:
> > Since a full sync is now done to about 5mins, I broke
> > down the output a bit. It appears that the longest
> > part (2:45m) is now the time spent scrolling though
> > each
> >
> > change still. Each one of these takes about 2ms:
> > * [new branch] refs/changes/99/71199/1 ->
> >
> > refs/changes/99/71199/1
> >
> > Seems fast, but at about 80K... So, are there any
> > obvious N loops over the refs happening inside each of
> > of the [new branch] iterations?
>
> OK, I narrowed it down I believe. If I comment out the
> invalidate_cached_refs() line in write_ref_sha1(), it
> speeds through this section.
>
> I guess this makes sense, we invalidate the cache and
> have to rebuild it after every new ref is added?
> Perhaps a simple fix would be to move the invalidation
> right after all the refs are updated? Maybe
> write_ref_sha1 could take in a flag to tell it to not
> invalidate the cache so that during iterative updates it
> could be disabled and then run manually after the
> update?
OK, this thing has been bugging me...
I found some more surprising results, I hope you can follow
because there are corner cases here which have surprising
impacts.
** Important fact:
** ---------------
** When I clone my repo, it has about 4K tags which
** come in packed to the clone.
**
This fact has a heavy impact on how I test things. If I
choose to delete these packed-refs from the cloned repo and
then do a fetch of the changes, all of the tags are also
fetched along with these changes. This means that if I want
to test the impact of having packed-refs vs no packed refs,
on my change fetches, I need to first delete the packed-refs
file, and second fetch all the tags again, so that when I
fetch the changes, the repo only actually fetches changes,
not all the tags!
So, with this in mind, I have discovered, that the fetch
performance degradation by invalidating the caches in
write_ref_sha1() is actually due to the packed-refs being
reloaded and resorted again on each ref insertion (not the
loose refs)!!!
Remember the important fact above? Yeah, those silly 4K
refs (not a huge number, not 61K!) take a while to reread
from the file and sort. When this is done for 61K changes,
it adds a lot of time to a fetch. The sad part is that, of
course, the packed-refs don't really need to be invalidated
since we never add new refs as packed refs during a fetch
(but apparently we do during a clone)! Also noteworthy is
that invalidating the loose refs, does not cause a big
delay.
Some data:
1) A fetch of the changes in my series with all good
external patches applied takes about 7:30min.
2) A fetch of the changes with #1 invalidate_cache_refs()
commented out in write_ref_sha1() takes about 1:50min.
3) A fetch of the changes with #1 with
invalidate_cache_refs() in write_ref_sha1() replaced with a
call to my custom invalidate_loose_cache_refs() takes about
1:50min.
4) A fetch with #1 on a repo with packed-refs deleted after
the clone, takes about ~5min.
** This is a strange regression which threw me off. In this
case, all the tags are refetched in addition to the changes,
this seems to cause some weird interaction that makes things
take longer than they should (#5 + #6 = 2:10m << #4 5min).
5) A fetch with #1 on a repo with packed-refs deleted after
the clone, and then a fetch done to get all the tags (see
#6), takes only 1:30m!!!!
6) A fetch to get all the **TAGS** with packed-refs deleted
after the clone, takes about 40s.
---Additional side data/tests:
7) A fetch of the changes with #1 and a special flag causing
the packed-refs to be read from the file, but not parsed or
sorted, takes 2:34min. So just the repeated reads add at
least 40s.
8) A fetch of the changes with #1 and a special flag causing
the packed-refs to be read from the file, parsed, but NOT
sorted, takes 3:40min. So the parsing appears to take an
additional minute at least.
I think that all of this might explain why no matter how
good Michael's intentions are with his patch series, his
series isn't likely to fix this problem unless he does not
invalidate the packed-refs after each insertion. I tried
preventing this invalidation in his series to prove this,
but unfortunately, it appears that in his series it is no
longer possible to only invalidate just the packed-refs? :(
Michael, I hope I am completely wrong about that...
Are there any good consistency reasons to invalidate the
packed refs in write_ref_sha1()? If not, would you accept a
patch to simply skip this invalidation (to only invalidate
the loose refs)?
Thanks,
-Martin
--
Employee of Qualcomm Innovation Center, Inc. which is a
member of Code Aurora Forum
^ permalink raw reply
* Recovering Committed Changes in a Detached Head?
From: Daly Gutierrez @ 2011-10-08 20:58 UTC (permalink / raw)
To: git
Is this possible after changing from the Detached Head branch to an
existing branch? How about if I don't remember the commit SHA1 ID?
What I did, to the best of my knowledge:
1) Checked out a previous version:
> git checkout 3a5bb38a83c00f7acab573f0ec836577143200aa
2) Modified file and committed the changes in the detached branch.
> git log
commit 92aa5381b9f7229523dba42aa94735c30f173451
Author: Daly Gutierrez <Daly.Gutierrez@gmail.com>
Date: Sat Oct 8 16:20:11 2011 -0400
Committing this in the Detached Head
3) For curiosity,
> git branch
* (no branch)
New_Branch
Second_New_Branch
master
4) Changed to 'New_Branch' branch... I no longer see the detached
branch...
> git branch
* New_Branch
Second_New_Branch
master
5) Want to access the file with the changes I made in the Detached
branch, but don't know how... PLEASE HELP?
^ permalink raw reply
* [PATCH v3] Teach merge the '[-e|--edit]' option
From: Jay Soffian @ 2011-10-08 18:39 UTC (permalink / raw)
To: git; +Cc: Jay Soffian, Junio C Hamano, Todd A. Jacobs
Implemented internally instead of as "git merge --no-commit && git commit"
so that "merge --edit" is otherwise consistent (hooks, etc) with "merge".
Note: the edit message does not include the status information that one
gets with "commit --status" and it is cleaned up after editing like one
gets with "commit --cleanup=default". A later patch could add the status
information if desired.
Note: previously we were not calling stripspace() after running the
prepare-commit-msg hook. Now we are, stripping comments and
leading/trailing whitespace lines if --edit is given, otherwise only
stripping leading/trailing whitespace lines if not given --edit.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
I probably can't spend more time on this patch any time soon. Hopefully
this iteration is close enough. If not, maybe Todd can help.
Documentation/merge-options.txt | 6 ++
builtin/merge.c | 109 +++++++++++++++++++++++++--------------
t/t7600-merge.sh | 15 +++++
3 files changed, 91 insertions(+), 39 deletions(-)
diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index b613d4ed08..6bd0b041c3 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -7,6 +7,12 @@ With --no-commit perform the merge but pretend the merge
failed and do not autocommit, to give the user a chance to
inspect and further tweak the merge result before committing.
+--edit::
+-e::
++
+ Invoke editor before committing successful merge to further
+ edit the default merge message.
+
--ff::
--no-ff::
Do not generate a merge commit if the merge resolved as
diff --git a/builtin/merge.c b/builtin/merge.c
index ee56974371..fcb7a60bfa 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -46,7 +46,7 @@ static const char * const builtin_merge_usage[] = {
static int show_diffstat = 1, shortlog_len, squash;
static int option_commit = 1, allow_fast_forward = 1;
-static int fast_forward_only;
+static int fast_forward_only, option_edit;
static int allow_trivial = 1, have_message;
static struct strbuf merge_msg;
static struct commit_list *remoteheads;
@@ -190,6 +190,8 @@ static struct option builtin_merge_options[] = {
"create a single commit instead of doing a merge"),
OPT_BOOLEAN(0, "commit", &option_commit,
"perform a commit if the merge succeeds (default)"),
+ OPT_BOOLEAN('e', "edit", &option_edit,
+ "edit message before committing"),
OPT_BOOLEAN(0, "ff", &allow_fast_forward,
"allow fast-forward (default)"),
OPT_BOOLEAN(0, "ff-only", &fast_forward_only,
@@ -842,30 +844,54 @@ static void add_strategies(const char *string, unsigned attr)
}
-static void write_merge_msg(void)
+static void write_merge_msg(struct strbuf *msg)
{
int fd = open(git_path("MERGE_MSG"), O_WRONLY | O_CREAT, 0666);
if (fd < 0)
die_errno(_("Could not open '%s' for writing"),
git_path("MERGE_MSG"));
- if (write_in_full(fd, merge_msg.buf, merge_msg.len) != merge_msg.len)
+ if (write_in_full(fd, msg->buf, msg->len) != msg->len)
die_errno(_("Could not write to '%s'"), git_path("MERGE_MSG"));
close(fd);
}
-static void read_merge_msg(void)
+static void read_merge_msg(struct strbuf *msg)
{
- strbuf_reset(&merge_msg);
- if (strbuf_read_file(&merge_msg, git_path("MERGE_MSG"), 0) < 0)
+ strbuf_reset(msg);
+ if (strbuf_read_file(msg, git_path("MERGE_MSG"), 0) < 0)
die_errno(_("Could not read from '%s'"), git_path("MERGE_MSG"));
}
-static void run_prepare_commit_msg(void)
+static void write_merge_state(void);
+static void abort_commit(const char *err_msg)
{
- write_merge_msg();
+ if (err_msg)
+ error("%s", err_msg);
+ fprintf(stderr,
+ _("Not committing merge; use 'git commit' to complete the merge.\n"));
+ write_merge_state();
+ exit(1);
+}
+
+static void prepare_to_commit(void)
+{
+ struct strbuf msg = STRBUF_INIT;
+ strbuf_addbuf(&msg, &merge_msg);
+ strbuf_addch(&msg, '\n');
+ write_merge_msg(&msg);
run_hook(get_index_file(), "prepare-commit-msg",
git_path("MERGE_MSG"), "merge", NULL, NULL);
- read_merge_msg();
+ if (option_edit) {
+ if (launch_editor(git_path("MERGE_MSG"), NULL, NULL))
+ abort_commit(NULL);
+ }
+ read_merge_msg(&msg);
+ stripspace(&msg, option_edit);
+ if (!msg.len)
+ abort_commit(_("Empty commit message."));
+ strbuf_release(&merge_msg);
+ strbuf_addbuf(&merge_msg, &msg);
+ strbuf_release(&msg);
}
static int merge_trivial(void)
@@ -879,7 +905,7 @@ static int merge_trivial(void)
parent->next = xmalloc(sizeof(*parent->next));
parent->next->item = remoteheads->item;
parent->next->next = NULL;
- run_prepare_commit_msg();
+ prepare_to_commit();
commit_tree(merge_msg.buf, result_tree, parent, result_commit, NULL);
finish(result_commit, "In-index merge");
drop_save();
@@ -907,9 +933,9 @@ static int finish_automerge(struct commit_list *common,
for (j = remoteheads; j; j = j->next)
pptr = &commit_list_insert(j->item, pptr)->next;
}
- free_commit_list(remoteheads);
strbuf_addch(&merge_msg, '\n');
- run_prepare_commit_msg();
+ prepare_to_commit();
+ free_commit_list(remoteheads);
commit_tree(merge_msg.buf, result_tree, parents, result_commit, NULL);
strbuf_addf(&buf, "Merge made by the '%s' strategy.", wt_strategy);
finish(result_commit, buf.buf);
@@ -1015,6 +1041,36 @@ static int setup_with_upstream(const char ***argv)
return i;
}
+static void write_merge_state(void)
+{
+ int fd;
+ struct commit_list *j;
+ struct strbuf buf = STRBUF_INIT;
+
+ for (j = remoteheads; j; j = j->next)
+ strbuf_addf(&buf, "%s\n",
+ sha1_to_hex(j->item->object.sha1));
+ fd = open(git_path("MERGE_HEAD"), O_WRONLY | O_CREAT, 0666);
+ if (fd < 0)
+ die_errno(_("Could not open '%s' for writing"),
+ git_path("MERGE_HEAD"));
+ if (write_in_full(fd, buf.buf, buf.len) != buf.len)
+ die_errno(_("Could not write to '%s'"), git_path("MERGE_HEAD"));
+ close(fd);
+ strbuf_addch(&merge_msg, '\n');
+ write_merge_msg(&merge_msg);
+ fd = open(git_path("MERGE_MODE"), O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ if (fd < 0)
+ die_errno(_("Could not open '%s' for writing"),
+ git_path("MERGE_MODE"));
+ strbuf_reset(&buf);
+ if (!allow_fast_forward)
+ strbuf_addf(&buf, "no-ff");
+ if (write_in_full(fd, buf.buf, buf.len) != buf.len)
+ die_errno(_("Could not write to '%s'"), git_path("MERGE_MODE"));
+ close(fd);
+}
+
int cmd_merge(int argc, const char **argv, const char *prefix)
{
unsigned char result_tree[20];
@@ -1418,33 +1474,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
if (squash)
finish(NULL, NULL);
- else {
- int fd;
- struct commit_list *j;
-
- for (j = remoteheads; j; j = j->next)
- strbuf_addf(&buf, "%s\n",
- sha1_to_hex(j->item->object.sha1));
- fd = open(git_path("MERGE_HEAD"), O_WRONLY | O_CREAT, 0666);
- if (fd < 0)
- die_errno(_("Could not open '%s' for writing"),
- git_path("MERGE_HEAD"));
- if (write_in_full(fd, buf.buf, buf.len) != buf.len)
- die_errno(_("Could not write to '%s'"), git_path("MERGE_HEAD"));
- close(fd);
- strbuf_addch(&merge_msg, '\n');
- write_merge_msg();
- fd = open(git_path("MERGE_MODE"), O_WRONLY | O_CREAT | O_TRUNC, 0666);
- if (fd < 0)
- die_errno(_("Could not open '%s' for writing"),
- git_path("MERGE_MODE"));
- strbuf_reset(&buf);
- if (!allow_fast_forward)
- strbuf_addf(&buf, "no-ff");
- if (write_in_full(fd, buf.buf, buf.len) != buf.len)
- die_errno(_("Could not write to '%s'"), git_path("MERGE_MODE"));
- close(fd);
- }
+ else
+ write_merge_state();
if (merge_was_ok) {
fprintf(stderr, _("Automatic merge went well; "
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 87aac835a1..8c6b811718 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -643,4 +643,19 @@ test_expect_success 'amending no-ff merge commit' '
test_debug 'git log --graph --decorate --oneline --all'
+cat >editor <<\EOF
+#!/bin/sh
+# strip comments and blank lines from end of message
+sed -e '/^#/d' < "$1" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > expected
+EOF
+chmod 755 editor
+
+test_expect_success 'merge --no-ff --edit' '
+ git reset --hard c0 &&
+ EDITOR=./editor git merge --no-ff --edit c1 &&
+ verify_parents $c0 $c1 &&
+ git cat-file commit HEAD | sed "1,/^$/d" > actual &&
+ test_cmp actual expected
+'
+
test_done
--
1.7.7.147.g4f6dc9
^ permalink raw reply related
* [PATCHv5 6/6] gitweb: Add gitweb manpages to 'gitweb' package in git.spec
From: Jakub Narebski @ 2011-10-08 18:32 UTC (permalink / raw)
To: git, Drew Northup; +Cc: Jonathan Nieder, Jakub Narebski
In-Reply-To: <1318098723-12813-1-git-send-email-jnareb@gmail.com>
This patch follows similar lines in %files section for 'gitk' and
'git-gui' subpackages.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This version adds gitweb's README and INSTALL to 'gitweb' subpackage.
git.spec.in | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/git.spec.in b/git.spec.in
index 91c8462..c562c62 100644
--- a/git.spec.in
+++ b/git.spec.in
@@ -199,7 +199,11 @@ rm -rf $RPM_BUILD_ROOT
%files -n gitweb
%defattr(-,root,root)
+%doc gitweb/README gitweb/INSTALL Documentation/*gitweb*.txt
%{_datadir}/gitweb
+%{!?_without_docs: %{_mandir}/man1/*gitweb*.1*}
+%{!?_without_docs: %{_mandir}/man5/*gitweb*.5*}
+%{!?_without_docs: %doc Documentation/*gitweb*.html }
%files -n perl-Git -f perl-files
%defattr(-,root,root)
@@ -208,6 +212,9 @@ rm -rf $RPM_BUILD_ROOT
# No files for you!
%changelog
+* Sun Sep 18 2011 Jakub Narebski <jnareb@gmail.com>
+- Add gitweb manpages to 'gitweb' subpackage
+
* Wed Jun 30 2010 Junio C Hamano <gitster@pobox.com>
- Add 'gitweb' subpackage.
--
1.7.6
^ permalink raw reply related
* [PATCHv5 5/6] Documentation: Add gitweb config variables to git-config(1)
From: Jakub Narebski @ 2011-10-08 18:32 UTC (permalink / raw)
To: git, Drew Northup; +Cc: Jonathan Nieder, Jakub Narebski
In-Reply-To: <1318098723-12813-1-git-send-email-jnareb@gmail.com>
Add a list of gitweb config variables to git-config(1) manpage, just
linking to gitweb(1) or gitweb.conf(5).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch is new in this series.
BTW. there was a patch from Thomas Rast, which you can see e.g. in
't/doc-config-extraction' branch in my repositories:
http://repo.or.cz/w/git/jnareb-git.git
https://github.com/jnareb/git
which made git generate such thing automatically.
Documentation/config.txt | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 03296b7..b30c7e6 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1071,6 +1071,23 @@ All gitcvs variables except for 'gitcvs.usecrlfattr' and
is one of "ext" and "pserver") to make them apply only for the given
access method.
+gitweb.category::
+gitweb.description::
+gitweb.owner::
+gitweb.url::
+ See linkgit:gitweb[1] for description.
+
+gitweb.avatar::
+gitweb.blame::
+gitweb.grep::
+gitweb.highlight::
+gitweb.patches::
+gitweb.pickaxe::
+gitweb.remote_heads::
+gitweb.showsizes::
+gitweb.snapshot::
+ See linkgit:gitweb.conf[5] for description.
+
grep.lineNumber::
If set to true, enable '-n' option by default.
--
1.7.6
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox