* sane, stable renames; when a commit should commit twice
@ 2007-12-23 2:03 Zenaan Harkness
2007-12-23 2:26 ` David Symonds
2007-12-23 2:50 ` Junio C Hamano
0 siblings, 2 replies; 4+ messages in thread
From: Zenaan Harkness @ 2007-12-23 2:03 UTC (permalink / raw)
To: git
When should a commit, commit twice?
When one or more git mv file renames/ moves are involved.
In such a case the commit ought to be split into two. Perhaps move the
files in the first commit, then make the changes needed to support the
move in the build chain (including changes in the moved files) in the
second commit.
This keeps a clean record of the move, making the move, and the
associated changes (as two commits) a clean cherry.
Does this make sense?
I develop in the java world, and we use packages (directories, and
subdirectories, sub-sub... etc) a lot, and so it is not uncommon in my
10 years development, to decide to reorganise some package/dir every now
and then, and files, and whole dirs, get moved.
I've only been using git for a few weeks, but finding it truly awesome!
A little demanding in the initial learning curve - took me three days of
reading and a little experiementation here and there, before I finally
felt comfortable with rebasing, branching, etc, to effect my work
pattern.
Have used arch/tla, a little bzr, aegis for a couple of years long time
ago, some cvs, and bk for four months or so.
I'm hoping that the above workflow, which has just crystallized for me
in the last two days, makes sense.
zen
--
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sane, stable renames; when a commit should commit twice
2007-12-23 2:03 sane, stable renames; when a commit should commit twice Zenaan Harkness
@ 2007-12-23 2:26 ` David Symonds
2007-12-23 16:29 ` Jakub Narebski
2007-12-23 2:50 ` Junio C Hamano
1 sibling, 1 reply; 4+ messages in thread
From: David Symonds @ 2007-12-23 2:26 UTC (permalink / raw)
To: Zenaan Harkness; +Cc: git
On Dec 23, 2007 1:03 PM, Zenaan Harkness <zen@freedbms.net> wrote:
> When should a commit, commit twice?
>
> When one or more git mv file renames/ moves are involved.
>
> In such a case the commit ought to be split into two. Perhaps move the
> files in the first commit, then make the changes needed to support the
> move in the build chain (including changes in the moved files) in the
> second commit.
>
> This keeps a clean record of the move, making the move, and the
> associated changes (as two commits) a clean cherry.
>
> Does this make sense?
Not particularly. Git commits are not (conceptually) changes or
deltas; they are snapshots of a tree of files at a particular time.
How does the tree state at your above first commit make any sense? It
is broken. Git's rename/move detection is smart enough to notice that
a rename + small-changes is close enough to a rename, so just trust
that to get it right.
Dave.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sane, stable renames; when a commit should commit twice
2007-12-23 2:03 sane, stable renames; when a commit should commit twice Zenaan Harkness
2007-12-23 2:26 ` David Symonds
@ 2007-12-23 2:50 ` Junio C Hamano
1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-12-23 2:50 UTC (permalink / raw)
To: Zenaan Harkness; +Cc: git
Zenaan Harkness <zen@freedbms.net> writes:
> When should a commit, commit twice?
>
> When one or more git mv file renames/ moves are involved.
> ...
> Does this make sense?
Anything that feels right to you is right for _your_ project, so
asking that question does not add much value, but I would not
personally do that myself. I may have pure rename commits that
move files around without changing any contents in my history,
but that is only because there happened to be no need to change
the contents in those commits, not because I followed an
artificial "a rename-only commit, followed by a commit that
edits" dogma you seem to be suggesting.
If I move file common.c to lib/common.c and common.h to
include/common.h, I would definitely NOT record that as two
events, if common.c used to include common.h. My commit that
moves these two files will definitely contain edit to common.c
(now lib/common.c) that changes at least one line:
-#include "common.h"
+#include "../include/common.h"
in the same commit. If you split this as two events, your first
"rename only" commit would not even build.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sane, stable renames; when a commit should commit twice
2007-12-23 2:26 ` David Symonds
@ 2007-12-23 16:29 ` Jakub Narebski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Narebski @ 2007-12-23 16:29 UTC (permalink / raw)
To: git
David Symonds wrote:
> On Dec 23, 2007 1:03 PM, Zenaan Harkness <zen@freedbms.net> wrote:
>> When should a commit, commit twice?
>>
>> When one or more git mv file renames/ moves are involved.
>>
>> In such a case the commit ought to be split into two. Perhaps move the
>> files in the first commit, then make the changes needed to support the
>> move in the build chain (including changes in the moved files) in the
>> second commit.
>>
>> This keeps a clean record of the move, making the move, and the
>> associated changes (as two commits) a clean cherry.
>>
>> Does this make sense?
>
> Not particularly. Git commits are not (conceptually) changes or
> deltas; they are snapshots of a tree of files at a particular time.
> How does the tree state at your above first commit make any sense? It
> is broken. Git's rename/move detection is smart enough to notice that
> a rename + small-changes is close enough to a rename, so just trust
> that to get it right.
Moreover renames detection during merges is based on three states:
ours, theirs and ancestor, and it would not take into account
"pure rename" commit it is there in the middle of one of chains.
Besides broken (not compiling) commit makes it harder for bisect to find
true bug later.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-23 16:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-23 2:03 sane, stable renames; when a commit should commit twice Zenaan Harkness
2007-12-23 2:26 ` David Symonds
2007-12-23 16:29 ` Jakub Narebski
2007-12-23 2:50 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).