* Re: [PATCH] git-stash: Fix listing stashes
From: Junio C Hamano @ 2007-11-07 22:03 UTC (permalink / raw)
To: Emil Medve; +Cc: nanako3, git
In-Reply-To: <1194469827-17037-1-git-send-email-Emilian.Medve@Freescale.com>
Oops, indeed. Thanks.
^ permalink raw reply
* Inconsistencies with git log
From: Jon Smirl @ 2007-11-07 22:15 UTC (permalink / raw)
To: Git Mailing List
In project root:
git log arch/powerpc/platforms/52xx
works as expected
cd arch/powerpc/platforms/52xx
git log arch/powerpc/platforms/52xx
fatal: ambiguous argument 'arch/powerpc/platforms/52xx': unknown
revision or path not in the working tree.
Use '--' to separate paths from revisions
still in arch/powerpc/platforms/52xx
git log
get log for the whole project
Shouldn't git log give the the log for the tree under the current directory?
jonsmirl@terra:~/mpc5200b/arch/powerpc/platforms/52xx$ git --version
git version 1.5.3.4.1458.g3e72e
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: [PATCH v2] user-manual: add advanced topic "bisecting merges"
From: Benoit Sigoure @ 2007-11-07 22:16 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: gitster, Ralf.Wildenhues, git
In-Reply-To: <11944722214046-git-send-email-prohaska@zib.de>
[-- Attachment #1: Type: text/plain, Size: 6860 bytes --]
Hi Steffen,
On Nov 7, 2007, at 10:50 PM, Steffen Prohaska wrote:
> This commits adds a discussion of the challenge of bisecting
> merge commits to the user manual. The text is slightly
> adapted from a mail by Junio C Hamano <gitster@pobox.com>
> to the mailing list
> <http://marc.info/?l=git&m=119403257315527&w=2>.
>
> The discussion is added to "Exploring git history" in a
> sub-section titled "Advanced topics". The discussion requires
> detailed knowledge about git. It is assumed that the reader will
> skip advanced topics on first reading. At least the text suggest
> to do so.
>
> Signed-off-by: Steffen Prohaska <prohaska@zib.de>
> ---
> Documentation/user-manual.txt | 89 ++++++++++++++++++++++++++++++
> +++++++++++
> 1 files changed, 89 insertions(+), 0 deletions(-)
>
> Some minor errors were fixed. Thanks to <Ralf.Wildenhues@gmx.de>.
>
> I kept the naming of the commits. Benoit Sigoure suggested to choose
> a different naming which he claims would be easier to remember.
> I'm not convinced. The current naming starts with X, Y, Z on the left
> and names the remaining commits on the right with A, B, C, D. This
> is simple and give sufficient orientation.
I still disagree but... fair enough ;)
You end up comparing [ABCD] with [XYZ] which (to me) is hard to
follow because it's like you were comparing two different kind of
entities. I tend to think more in term of branch (e.g. what's
happened to the upper branch and what's happened to the lower branch,
rather than think in terms of "before a point in time" and "after
that point in time"). Because of that, I constantly need to look
back at the scheme to find out what is `A', what is `Z' etc.
Some more comments below. Sorry for not spotting these earlier.
>
> diff --git a/Documentation/user-manual.txt b/Documentation/user-
> manual.txt
> index d99adc6..d0e738e 100644
> --- a/Documentation/user-manual.txt
> +++ b/Documentation/user-manual.txt
> @@ -934,6 +934,95 @@ Figuring out why this works is left as an
> exercise to the (advanced)
> student. The gitlink:git-log[1], gitlink:git-diff-tree[1], and
> gitlink:git-hash-object[1] man pages may prove helpful.
>
> +[[history-advanced-topics]]
> +Advanced topics
> +---------------
> +This section covers advanced topics that typically require more
> +knowledge about git than the manual presented to this point.
> +
> +You may want to skip the section at first reading, and come back
I think the correct wording here is "on first reading". If a native
English speaker could confirm this...
> +later when you have a better understanding of git.
> +
> +[[bisect-merges]]
> +Why bisecting merge commits can be harder than bisecting linear
> history
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~
> +The following text is based upon an email by Junio C. Hamano to
> +the git mailing list
> +(link:http://marc.info/?l=git&m=119403257315527&w=2[link:http://
> marc.info/?l=git&m=119403257315527&w=2]).
> +It was slightly adapted for this manual.
> +
> +Bisecting merges can be challenging due to the complexity of
> +changes introduced at a merge. Bisecting through merges is not a
s/at a merge/& point/ ?
> +technical problem. The real problem is what to do when the
> +culprit turns out to be a merge commit. How to spot what really
> +is wrong, and figure out how to fix. The problem is not for the
> +tool but for the human, and it is real.
> +
> +Imagine this history.
> +
> +................................................
> + ---Z---o---X---...---o---A---C---D
> + \ /
> + o---o---Y---...---o---B
> +................................................
> +
> +Suppose that on the upper development line, the meaning of one
> +of the functions that existed at Z was changed at commit X. The
> +commits from Z leading to A change both the function's
> +implementation and all calling sites that existed at Z, as well
> +as new calling sites they add, to be consistent. There is no
> +bug at A.
> +
> +Suppose in the meantime the lower development line somebody
s/Suppose/& that/
> +added a new calling site for that function at commit Y. The
> +commits from Z leading to B all assume the old semantics of that
> +function and the callers and the callee are consistent with each
> +other. There is no bug at B, either.
> +
> +You merge to create C. There is no textual conflict with this
> +three way merge, and the result merges cleanly. You bisect
> +this, because you found D is bad and you know Z was good. Your
> +bisect will find that C (merge) is broken. Understandably so,
> +as at C, the new calling site of the function added by the lower
> +branch is not converted to the new semantics, while all the
> +other calling sites that already existed at Z would have been
> +converted by the merge. The new calling site has semantic
> +adjustment needed, but you do not know that yet. You need to
s/adjustment/&s/
> +find out that that is the cause of the breakage by looking at the
> +merge commit C and the history leading to it.
> +
> +How would you do that?
> +
> +Both "git diff A C" and "git diff B C" would be an enormous patch.
> +Each of them essentially shows the whole change on each branch
> +since they diverged. The developers may have well behaved to
> +create good commits that follow the "commit small, commit often,
> +commit well contained units" mantra, and each individual commit
> +leading from Z to A and from Z to B may be easy to review and
> +understand, but looking at these small and easily reviewable
> +steps alone would not let you spot the breakage. You need to
> +have a global picture of what the upper branch did (and
> +among many, one of them is to change the semantics of that
> +particular function) and look first at the huge "diff A C"
> +(which shows the change the lower branch introduces), and see if
> +that huge change is consistent with what have been done between
> +Z and A.
> +
> +If you linearize the history by rebasing the lower branch on
> +top of the upper, instead of merging, the bug becomes much easier to
> +find and understand. Your history would instead be:
> +
> +................................................................
> + ---Z---o---X--...---o---A---o---o---Y*--...---o---B*--D*
> +................................................................
> +
> +and there is a single commit Y* between A and B* that introduced
> +the new calling site that still uses the old semantics of the
> +function, even though that was already modified at X. "git show
> +Y*" will be a much smaller patch than "git diff A C" and it is
> +much easier to deal with.
> +
> +
> [[Developing-with-git]]
> Developing with git
> ===================
Thank you!
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply
* git rebase --skip
From: Mike Hommey @ 2007-11-07 22:21 UTC (permalink / raw)
To: git
Hi,
I use git-rebase quite regularly, and I haven't used git-rebase --skip
after a failed merge without first resetting the working tree. I was
wondering if it wouldn't make sense to automatically do the reset when
running git-rebase --skip.
Mike
^ permalink raw reply
* Re: [PATCH] Fix mistakes in the documentation of git-add --interactive.
From: Johannes Schindelin @ 2007-11-07 22:25 UTC (permalink / raw)
To: Benoit Sigoure; +Cc: git, gitster
In-Reply-To: <1194472947-8601-1-git-send-email-tsuna@lrde.epita.fr>
Hi,
On Wed, 7 Nov 2007, Benoit Sigoure wrote:
> - a - add the change from that hunk and all the rest to index
> - d - do not the change from that hunk nor any of the rest to index
> + a - add the change from that hunk and all the remaining ones
> + d - do not the add change from that hunk and skip the remaining ones
This still sounds funny. How about
d - skip this hunk, as well as the remaining ones
Hmm?
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH v2] user-manual: add advanced topic "bisecting merges"
From: J. Bruce Fields @ 2007-11-07 22:26 UTC (permalink / raw)
To: Benoit Sigoure; +Cc: Steffen Prohaska, gitster, Ralf.Wildenhues, git
In-Reply-To: <F783880C-A0F9-45D9-A23A-075600B31CEE@lrde.epita.fr>
On Wed, Nov 07, 2007 at 11:16:06PM +0100, Benoit Sigoure wrote:
> Hi Steffen,
>
> On Nov 7, 2007, at 10:50 PM, Steffen Prohaska wrote:
>
>> This commits adds a discussion of the challenge of bisecting
>> merge commits to the user manual. The text is slightly
>> adapted from a mail by Junio C Hamano <gitster@pobox.com>
>> to the mailing list
>> <http://marc.info/?l=git&m=119403257315527&w=2>.
>>
>> The discussion is added to "Exploring git history" in a
>> sub-section titled "Advanced topics". The discussion requires
>> detailed knowledge about git. It is assumed that the reader will
>> skip advanced topics on first reading. At least the text suggest
>> to do so.
>>
>> Signed-off-by: Steffen Prohaska <prohaska@zib.de>
>> ---
>> Documentation/user-manual.txt | 89
>> +++++++++++++++++++++++++++++++++++++++++
>> 1 files changed, 89 insertions(+), 0 deletions(-)
>>
>> Some minor errors were fixed. Thanks to <Ralf.Wildenhues@gmx.de>.
>>
>> I kept the naming of the commits. Benoit Sigoure suggested to choose
>> a different naming which he claims would be easier to remember.
>> I'm not convinced. The current naming starts with X, Y, Z on the left
>> and names the remaining commits on the right with A, B, C, D. This
>> is simple and give sufficient orientation.
>
> I still disagree but... fair enough ;)
> You end up comparing [ABCD] with [XYZ] which (to me) is hard to follow
> because it's like you were comparing two different kind of entities. I
> tend to think more in term of branch (e.g. what's happened to the upper
> branch and what's happened to the lower branch, rather than think in terms
> of "before a point in time" and "after that point in time"). Because of
> that, I constantly need to look back at the scheme to find out what is `A',
> what is `Z' etc.
>
> Some more comments below. Sorry for not spotting these earlier.
>
>>
>> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
>> index d99adc6..d0e738e 100644
>> --- a/Documentation/user-manual.txt
>> +++ b/Documentation/user-manual.txt
>> @@ -934,6 +934,95 @@ Figuring out why this works is left as an exercise to
>> the (advanced)
>> student. The gitlink:git-log[1], gitlink:git-diff-tree[1], and
>> gitlink:git-hash-object[1] man pages may prove helpful.
>>
>> +[[history-advanced-topics]]
>> +Advanced topics
>> +---------------
>> +This section covers advanced topics that typically require more
>> +knowledge about git than the manual presented to this point.
>> +
>> +You may want to skip the section at first reading, and come back
>
> I think the correct wording here is "on first reading". If a native
> English speaker could confirm this...
Confirmed....
--b.
^ permalink raw reply
* Re: [PATCH] Fix mistakes in the documentation of git-add --interactive.
From: Benoit Sigoure @ 2007-11-07 22:28 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, gitster
In-Reply-To: <Pine.LNX.4.64.0711072224200.4362@racer.site>
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
On Nov 7, 2007, at 11:25 PM, Johannes Schindelin wrote:
> Hi,
>
> On Wed, 7 Nov 2007, Benoit Sigoure wrote:
>
>> - a - add the change from that hunk and all the rest to index
>> - d - do not the change from that hunk nor any of the rest
>> to index
>> + a - add the change from that hunk and all the remaining ones
>> + d - do not the add change from that hunk and skip the
>> remaining ones
>
> This still sounds funny. How about
>
> d - skip this hunk, as well as the remaining ones
Yup, that's better, indeed. I'll post a v3 (:
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply
* [PATCH v3] Fix mistakes in the documentation of git-add --interactive.
From: Benoit Sigoure @ 2007-11-07 22:31 UTC (permalink / raw)
To: git; +Cc: gitster, Benoit Sigoure
In-Reply-To: <Pine.LNX.4.64.0711072224200.4362@racer.site>
This patch fixes a couple of language issues in the documentation
of the `patch' sub-command of git-add --interactive.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
---
Use better wording proposed by Dscho.
Documentation/git-add.txt | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 963e1ab..3117798 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -201,9 +201,9 @@ patch::
the change of each hunk. You can say:
y - add the change from that hunk to index
- n - do not add the change from that hunk to index
- a - add the change from that hunk and all the rest to index
- d - do not the change from that hunk nor any of the rest to index
+ n - skip this hunk
+ a - add the change from that hunk and all the remaining ones
+ d - skip this hunk, as well as the remaining ones
j - do not decide on this hunk now, and view the next
undecided hunk
J - do not decide on this hunk now, and view the next hunk
@@ -211,8 +211,8 @@ patch::
undecided hunk
K - do not decide on this hunk now, and view the previous hunk
+
-After deciding the fate for all hunks, if there is any hunk
-that was chosen, the index is updated with the selected hunks.
+After deciding the fate of each hunk, the index is updated with the selected
+ones.
diff::
--
1.5.3.4.398.g859b
^ permalink raw reply related
* [PATCH] restore fetching with thin-pack capability
From: Nicolas Pitre @ 2007-11-07 22:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Broken since commit fa74052922cf39e5a39ad7178d1b13c2da9b4519.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 862652b..bb1742f 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -32,7 +32,7 @@ static const char fetch_pack_usage[] =
#define MAX_IN_VAIN 256
static struct commit_list *rev_list;
-static int non_common_revs, multi_ack, use_thin_pack, use_sideband;
+static int non_common_revs, multi_ack, use_sideband;
static void rev_list_push(struct commit *commit, int mark)
{
@@ -178,7 +178,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
(multi_ack ? " multi_ack" : ""),
(use_sideband == 2 ? " side-band-64k" : ""),
(use_sideband == 1 ? " side-band" : ""),
- (use_thin_pack ? " thin-pack" : ""),
+ (args.use_thin_pack ? " thin-pack" : ""),
(args.no_progress ? " no-progress" : ""),
" ofs-delta");
else
^ permalink raw reply related
* [PATCH v3] Add Documentation/CodingGuidelines
From: Johannes Schindelin @ 2007-11-07 22:35 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: Andreas Ericsson, Junio C Hamano, Ralf Wildenhues, git
In-Reply-To: <200711072243.21086.robin.rosenberg.lists@dewire.com>
Even if our code is quite a good documentation for our coding style,
some people seem to prefer a document describing it.
The part about the shell scripts is clearly just copied from one of
Junio's helpful mails, and some parts were added from comments by
Junio, Andreas Ericsson and Robin Rosenberg.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
I think I owe this list an apology for starting yet another
thread which seems to instigate comments by not many
code contributors.
My intention was to make things simpler, but it appears
that the human brain was created such that it needs complexity
and creates it when it is absent.
For example, when I wrote "guidelines" I fully expected that
it was understood that these are no natural laws which you
cannot break, should the circumstances afford it.
Given the discussion, I am half convinced that even this
patch is a bad idea, and am quite willing to just stop sending
updates to it.
Documentation/CodingGuidelines | 106 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 106 insertions(+), 0 deletions(-)
create mode 100644 Documentation/CodingGuidelines
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
new file mode 100644
index 0000000..2d8656f
--- /dev/null
+++ b/Documentation/CodingGuidelines
@@ -0,0 +1,106 @@
+As a popular project, we also have some guidelines to keep to the
+code. For git in general, two rough rules are:
+
+ - Most importantly, we never say "It's in POSIX; we'll happily
+ ignore your needs should your system that does not conform."
+ We live in the real world.
+
+ - However, we often say "Let's stay away from that construct,
+ it's not even in POSIX".
+
+ - In spite of the above two rules, we sometimes say "Although
+ this is not in POSIX, it (is so convenient | makes the code
+ much more readable | has other good characteristics) and
+ practically all the platforms we care about support it, so
+ let's use it". Again, we live in the real world, and it is
+ sometimes a judgement call, decided based more on real world
+ constraints people face than what the paper standard says.
+
+
+As for more concrete guidelines, just imitate the existing code
+(this is a good guideline, no matter which project you are contributing
+to...). But if you must have some list of rules, here they are.
+
+For shell scripts specifically (not exhaustive):
+
+ - We prefer $( ... ) for command substitution; unlike ``, it
+ properly nests. It should have been the way Bourne spelled
+ it from day one, but unfortunately isn't.
+
+ - We use ${parameter-word} and its [-=?+] siblings, and their
+ colon'ed "unset or null" form.
+
+ - We use ${parameter#word} and its [#%] siblings, and their
+ doubled "longest matching" form.
+
+ - We use Arithmetic Expansion $(( ... )).
+
+ - No "Substring Expansion" ${parameter:offset:length}.
+
+ - No shell arrays.
+
+ - No strlen ${#parameter}.
+
+ - No regexp ${parameter/pattern/string}.
+
+ - We do not use Process Substitution <(list) or >(list).
+
+ - We prefer "test" over "[ ... ]".
+
+ - We do not write noiseword "function" in front of shell
+ functions.
+
+For C programs:
+
+ - Use tabs to indent, and interpret tabs as taking up to 8 spaces
+
+ - Try to keep to at most 80 characters per line
+
+ - When declaring pointers, the star sides with the variable name, i.e.
+ "char *string", not "char* string" or "char * string". This makes
+ it easier to understand "char *string, c;"
+
+ - Do not use curly brackets unnecessarily. I.e.
+
+ if (bla) {
+ x = 1;
+ }
+
+ is frowned upon. A gray area is when the statement extends over a
+ few lines, and/or you have a lengthy comment atop of it. Also,
+ like in the Linux kernel, if there is a long list of "else if"
+ statements, it can make sense to add curly brackets to single
+ line blocks.
+
+ - Try to make your code understandable. You may put comments in, but
+ comments invariably tend to stale out when the code they were
+ describing changes. Often splitting a function into two makes the
+ intention of the code much clearer.
+
+ Double negation is often harder to understand than no negation at
+ all.
+
+ Some clever tricks, like using the !! operator with arithmetic
+ constructs, can be extremely confusing to others. Avoid them,
+ unless there is a compelling reason to use them.
+
+ - Use the API. No, really. We have a strbuf (variable length string),
+ several arrays with the ALLOC_GROW() macro, a path_list for sorted
+ string lists, a hash map (mapping struct objects) named
+ "struct decorate", amongst other things.
+
+ - When you come up with an API, document it.
+
+ - #include system headers in git-compat-util.h. Some headers on some
+ systems show subtle breakages when you change the order, so it is
+ best to keep them in one place.
+
+ - if you are planning a new command, consider writing it in shell or
+ perl first, so that changes in semantics can be easily changed and
+ discussed. Many git commands started out like that, and a few are
+ still scripts.
+
+ - Avoid introducing a new dependency into git. This means you usually
+ should stay away from scripting languages not already used in the git
+ core command set (unless your command is clearly separate from it,
+ such as an importer to convert random-scm-X repositories to git).
--
1.5.3.5.1597.g7191
^ permalink raw reply related
* Re: Inconsistencies with git log
From: Johannes Schindelin @ 2007-11-07 22:42 UTC (permalink / raw)
To: Jon Smirl; +Cc: Git Mailing List
In-Reply-To: <9e4733910711071415i1729e277u6be19b72cd682a85@mail.gmail.com>
Hi,
On Wed, 7 Nov 2007, Jon Smirl wrote:
> In project root:
> git log arch/powerpc/platforms/52xx
> works as expected
>
> cd arch/powerpc/platforms/52xx
> git log arch/powerpc/platforms/52xx
> fatal: ambiguous argument 'arch/powerpc/platforms/52xx': unknown
> revision or path not in the working tree.
> Use '--' to separate paths from revisions
Try "git log ."
Hth,
Dscho
^ permalink raw reply
* Re: Inconsistencies with git log
From: Jon Smirl @ 2007-11-07 22:45 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0711072242230.4362@racer.site>
On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Wed, 7 Nov 2007, Jon Smirl wrote:
>
> > In project root:
> > git log arch/powerpc/platforms/52xx
> > works as expected
> >
> > cd arch/powerpc/platforms/52xx
> > git log arch/powerpc/platforms/52xx
> > fatal: ambiguous argument 'arch/powerpc/platforms/52xx': unknown
> > revision or path not in the working tree.
> > Use '--' to separate paths from revisions
>
> Try "git log ."
Shouldn't git log default to "git log ."?
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: git rebase --skip
From: Johannes Schindelin @ 2007-11-07 22:48 UTC (permalink / raw)
To: Mike Hommey; +Cc: git
In-Reply-To: <20071107222105.GA31666@glandium.org>
Hi,
On Wed, 7 Nov 2007, Mike Hommey wrote:
> I use git-rebase quite regularly, and I haven't used git-rebase --skip
> after a failed merge without first resetting the working tree. I was
> wondering if it wouldn't make sense to automatically do the reset when
> running git-rebase --skip.
Makes sense to me. The user is already required to pass "--skip" to say
"scrap this patch".
FWIW --interactive already has this behaviour since it was added to
"official" git.
Ciao,
Dscho
^ permalink raw reply
* [PATCH] Deprecate git-lost-found
From: Johannes Schindelin @ 2007-11-07 22:54 UTC (permalink / raw)
To: git, gitster
"git fsck" learnt the option "--lost-found" in v1.5.3-rc0~5, to make
"git lost-found" obsolete. It is time to deprecate "git lost-found".
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Maybe we can remove it in another 5 months...
git-lost-found.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git-lost-found.sh b/git-lost-found.sh
index a5a32e7..9cedaf8 100755
--- a/git-lost-found.sh
+++ b/git-lost-found.sh
@@ -5,6 +5,8 @@ SUBDIRECTORY_OK='Yes'
OPTIONS_SPEC=
. git-sh-setup
+echo "WARNING: '$0' is deprecated in favor of 'git fsck --lost-found'" >&2
+
if [ "$#" != "0" ]
then
usage
--
1.5.3.5.1597.g7191
^ permalink raw reply related
* Re: git-svn questions: how to clone/init non-standard layout branches/tags?
From: Luke Lu @ 2007-11-07 22:56 UTC (permalink / raw)
To: Luke Lu; +Cc: Lars Hjemli, Benoit SIGOURE, git
In-Reply-To: <B0D0BB75-58AF-4E4E-8C3F-6E615870016A@vicaya.com>
In case others encounter this problem and want to find a solution...
On Nov 3, 2007, at 2:26 PM, Luke Lu wrote:
> On Nov 3, 2007, at 1:52 PM, Lars Hjemli wrote:
>> On Nov 3, 2007 9:41 PM, Luke Lu <git@vicaya.com> wrote:
>>> On Nov 3, 2007, at 1:32 PM, Lars Hjemli wrote:
>>>> On Nov 3, 2007 9:01 PM, Luke Lu <git@vicaya.com> wrote:
>>>>> I did try to add a "fetch" line for the production branch like
>>>>> this:
>>>>>
>>>>> [svn-remote "svn"]
>>>>> url = svn+ssh://host/svn/project
>>>>> fetch = production:refs/remotes/svn-prod
>>>>> fetch = trunk:refs/remotes/git-svn
>>>>>
>>>>> which is modeled after http://lists-archives.org/git/420712-git-
>>>>> svn-
>>>>> remote-tracking-branch-question.html
>>>>>
>>>> Did you forget to run 'git svn fetch' after modifying your .git/
>>>> config?
>>>
>>> Yes, I did. It didn't seem to do anything.
>>
>> Hmm, it works for me, I've been adding and removing branches like
>> this
>> for months, but my .git/config is slightly different:
>>
>> [svn-remote "svn"]
>> url = svn://example.org
>> fetch = project/trunk:refs/remotes/svn/trunk
>> fetch = project/branches/topic:refs/remotes/svn/topic
>>
>> I don't know if this difference is important, though...
>
> I tried to test this on a local repository like file:///path/
> project. It seems to work and get everything properly upon git svn
> fetch. However it doesn't work for the production branch. If I
> modify the fetch line a bit to svn/prod instead of svn-prod and try
> git svn fetch again. It would hang for about 2 minutes and return 0
> and show nothing in progress. A .git/svn/svn/prod directory is
> created but it's empty.
>
> One thing that might be special for this branch is that it gets
> deleted and recreated/copied all the time from trunk. I wonder if
> git-svn use some kind of heuristics to determine if there is
> anything to fetch and silently failing...
After some permutations, this is the config that worked for me:
[svn-remote "svn"]
url = svn+ssh://host/svn
fetch = project/trunk:refs/remotes/git-svn
fetch = project/production:refs/remotes/svn/production
The primary difference is that I moved 'project' from url to the
fetch specs. My original single trunk config looked like this:
[svn-remote "svn"]
url = svn+ssh://host/svn/project/trunk
fetch = :refs/remotes/git-svn
I wish that "git svn fetch" could be more verbose about what's going
on in this case.
__Luke
^ permalink raw reply
* Re: Inconsistencies with git log
From: Johannes Schindelin @ 2007-11-07 22:58 UTC (permalink / raw)
To: Jon Smirl; +Cc: Git Mailing List
In-Reply-To: <9e4733910711071445p7cfb6cffx83adb1d84d6bf9d8@mail.gmail.com>
Hi,
On Wed, 7 Nov 2007, Jon Smirl wrote:
> On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > On Wed, 7 Nov 2007, Jon Smirl wrote:
> >
> > > In project root:
> > > git log arch/powerpc/platforms/52xx
> > > works as expected
> > >
> > > cd arch/powerpc/platforms/52xx
> > > git log arch/powerpc/platforms/52xx
> > > fatal: ambiguous argument 'arch/powerpc/platforms/52xx': unknown
> > > revision or path not in the working tree.
> > > Use '--' to separate paths from revisions
> >
> > Try "git log ."
>
> Shouldn't git log default to "git log ."?
Well, it is in line with the other commands being able to work on
subdirectories, but doing the whole repository operation by default.
We also tend to take the approach of viewing the history as that of
the whole project.
This approach also means that it is a much more expensive operation to log
the history as seen by a subdirectory, which is another reason why it is
not the default.
Hth,
Dscho
^ permalink raw reply
* Re: Inconsistencies with git log
From: David Symonds @ 2007-11-07 23:00 UTC (permalink / raw)
To: Jon Smirl; +Cc: Johannes Schindelin, Git Mailing List
In-Reply-To: <9e4733910711071445p7cfb6cffx83adb1d84d6bf9d8@mail.gmail.com>
On Nov 8, 2007 9:45 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Hi,
> >
> > On Wed, 7 Nov 2007, Jon Smirl wrote:
> >
> > > In project root:
> > > git log arch/powerpc/platforms/52xx
> > > works as expected
> > >
> > > cd arch/powerpc/platforms/52xx
> > > git log arch/powerpc/platforms/52xx
> > > fatal: ambiguous argument 'arch/powerpc/platforms/52xx': unknown
> > > revision or path not in the working tree.
> > > Use '--' to separate paths from revisions
> >
> > Try "git log ."
>
> Shouldn't git log default to "git log ."?
It might be nice if it did, but since Git tracks whole *trees* (not
files) then it makes more sense to show the log of the repository in
its default mode.
On the other hand, it'd sure be nice if git-status would show relative
paths when you're in subdirectories, especially when you're in a
deeply nested directory hierarchy. It's a lot easier to see that
"foo.txt" and "../bar.txt" have modifications. Furthermore, it is the
relative path that you have to pass to git-add anyway, so quick
copy-n-pasting from git-status output often doesn't work.
Dave.
^ permalink raw reply
* Re: Inconsistencies with git log
From: Jon Smirl @ 2007-11-07 23:03 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0711072255420.4362@racer.site>
On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Shouldn't git log default to "git log ."?
>
> Well, it is in line with the other commands being able to work on
> subdirectories, but doing the whole repository operation by default.
I agree with this and see how it got this way.
> We also tend to take the approach of viewing the history as that of
> the whole project.
But if you type 'git log' while cd'd into a subdirectory the whole log
is almost never what you want. It's this kind of thing that makes git
harder to use.
> This approach also means that it is a much more expensive operation to log
> the history as seen by a subdirectory, which is another reason why it is
> not the default.
>
> Hth,
> Dscho
>
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: Inconsistencies with git log
From: Johannes Schindelin @ 2007-11-07 23:11 UTC (permalink / raw)
To: Jon Smirl; +Cc: Git Mailing List
In-Reply-To: <9e4733910711071503va92a653s25fd978989d5917d@mail.gmail.com>
Hi,
On Wed, 7 Nov 2007, Jon Smirl wrote:
> On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > We also tend to take the approach of viewing the history as that of
> > the whole project.
>
> But if you type 'git log' while cd'd into a subdirectory the whole log
> is almost never what you want. It's this kind of thing that makes git
> harder to use.
When I am working in a subdirectory, I often want the whole history. For
example, when I am working on the documentation, sometimes I need to look
up a commit real quick, that touched other parts.
Besides, adding a space and a dot is not what qualifies for "harder to
use" with this developer.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH v3] Add Documentation/CodingGuidelines
From: Junio C Hamano @ 2007-11-07 23:14 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Robin Rosenberg, Andreas Ericsson, Ralf Wildenhues, git
In-Reply-To: <Pine.LNX.4.64.0711072233010.4362@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> new file mode 100644
> index 0000000..2d8656f
> --- /dev/null
> +++ b/Documentation/CodingGuidelines
> @@ -0,0 +1,106 @@
> +As a popular project, we also have some guidelines to keep to the
> +code. For git in general, two rough rules are:
I'd rather not to say "As a popular project" here. That is
something for others to decide, not for us to advertise.
Also we now have three rules here ;-).
> +
> + - Most importantly, we never say "It's in POSIX; we'll happily
> + ignore your needs should your system that does not conform."
"should your system not conform"? "if your system does not
conform"?
> +As for more concrete guidelines, just imitate the existing code
> +(this is a good guideline, no matter which project you are contributing
> +to...). But if you must have some list of rules, here they are.
s/\.\.\.//;
> +For C programs:
> +
> + - Use tabs to indent, and interpret tabs as taking up to 8 spaces
> +
> + - Try to keep to at most 80 characters per line
> +
> + - When declaring pointers, the star sides with the variable name, i.e.
> + "char *string", not "char* string" or "char * string". This makes
> + it easier to understand "char *string, c;"
End each sentence with a full stop "." for consistency.
> +
> + - Do not use curly brackets unnecessarily. I.e.
> +
> + if (bla) {
> + x = 1;
> + }
> +
> + is frowned upon. A gray area is when the statement extends over a
> + few lines, and/or you have a lengthy comment atop of it. Also,
> + like in the Linux kernel, if there is a long list of "else if"
> + statements, it can make sense to add curly brackets to single
> + line blocks.
As Robin suggests, s/Do not use/Avoid using/ feels more in line
with the spirit with the "A gray area is..." description.
I think the official name for {} are "braces", by the way.
> + Double negation is often harder to understand than no negation at
> + all.
> +
> + Some clever tricks, like using the !! operator with arithmetic
> + constructs, can be extremely confusing to others. Avoid them,
> + unless there is a compelling reason to use them.
Need a bullet point "-" before "Double" (but not "Some").
> + - #include system headers in git-compat-util.h. Some headers on some
> + systems show subtle breakages when you change the order, so it is
> + best to keep them in one place.
> +
The first #include in C files except platform specific compat/
implementation should be git-compat-util.h or another header
file that includes it, such as cache.h and builtin.h.
> + - if you are planning a new command, consider writing it in shell or
> + perl first, so that changes in semantics can be easily changed and
> + discussed. Many git commands started out like that, and a few are
> + still scripts.
Begin a statement with a Capital letter, for consistency.
^ permalink raw reply
* [PATCH] git-branch --with=commit
From: Junio C Hamano @ 2007-11-07 23:15 UTC (permalink / raw)
To: git
This teaches git-branch to limit its listing to branches that
are descendants to the named commit.
When you are using many topic branches, you often would want to
see which branch already includes a commit, so that you know
which can and cannot be rewound without disrupting other people.
One thing that sometimes happens to me is:
* Somebody sends a patch that is a good maint material. I
apply it to 'maint':
$ git checkout maint
$ git am -3 -s obvious-fix.patch
* Then somebody else sends another patch that is possibly a
good maint material, but I'd want to cook it in 'next' to be
extra sure. I fork a topic from 'maint' and apply the patch:
$ git checkout -b xx/maint-fix-foo
$ git am -3 -s ,xx-maint-fix-foo.patch
* A minor typo is found in the "obvious-fix.patch".
The above happens without pushing the results out, so I can
freely recover from it by amending 'maint', as long as I do not
forget to rebase the topics that were forked previously.
With this patch, I could do this to find out which topic
branches already contain the faulty commit:
$ git branch --with=maint^ | grep /
xx/maint-fix-foo
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-branch.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index 3bf40f1..d13e64f 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -184,9 +184,30 @@ struct ref_item {
struct ref_list {
int index, alloc, maxwidth;
struct ref_item *list;
+ struct commit_list *with_commit;
int kinds;
};
+static int has_commit(const unsigned char *sha1, struct commit_list *with_commit)
+{
+ struct commit *commit;
+
+ if (!with_commit)
+ return 1;
+ commit = lookup_commit_reference_gently(sha1, 1);
+ if (!commit)
+ return 0;
+ while (with_commit) {
+ struct commit *other;
+
+ other = with_commit->item;
+ with_commit = with_commit->next;
+ if (in_merge_bases(other, &commit, 1))
+ return 1;
+ }
+ return 0;
+}
+
static int append_ref(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
{
struct ref_list *ref_list = (struct ref_list*)(cb_data);
@@ -206,6 +227,10 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
refname += 10;
}
+ /* Filter with with_commit if specified */
+ if (!has_commit(sha1, ref_list->with_commit))
+ return 0;
+
/* Don't add types the caller doesn't want */
if ((kind & ref_list->kinds) == 0)
return 0;
@@ -296,13 +321,14 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
}
}
-static void print_ref_list(int kinds, int detached, int verbose, int abbrev)
+static void print_ref_list(int kinds, int detached, int verbose, int abbrev, struct commit_list *with_commit)
{
int i;
struct ref_list ref_list;
memset(&ref_list, 0, sizeof(ref_list));
ref_list.kinds = kinds;
+ ref_list.with_commit = with_commit;
for_each_ref(append_ref, &ref_list);
qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);
@@ -505,6 +531,22 @@ static void rename_branch(const char *oldname, const char *newname, int force)
die("Branch is renamed, but update of config-file failed");
}
+static int opt_parse_with_commit(const struct option *opt, const char *arg, int unset)
+{
+ unsigned char sha1[20];
+ struct commit *commit;
+
+ if (!arg)
+ return -1;
+ if (get_sha1(arg, sha1))
+ die("malformed object name %s", arg);
+ commit = lookup_commit_reference(sha1);
+ if (!commit)
+ die("no such commit %s", arg);
+ commit_list_insert(commit, opt->value);
+ return 0;
+}
+
int cmd_branch(int argc, const char **argv, const char *prefix)
{
int delete = 0, force_delete = 0, force_create = 0;
@@ -512,6 +554,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0;
int reflog = 0, track;
int kinds = REF_LOCAL_BRANCH, kind_remote = 0, kind_any = 0;
+ struct commit_list *with_commit = NULL;
struct option options[] = {
OPT_GROUP("Generic options"),
@@ -519,6 +562,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN( 0 , "track", &track, "set up tracking mode (see git-pull(1))"),
OPT_BOOLEAN( 0 , "color", &branch_use_color, "use colored output"),
OPT_BOOLEAN('r', NULL, &kind_remote, "act on remote-tracking branches"),
+ OPT_CALLBACK(0, "with", &with_commit, "commit",
+ "print only branches that contain the commit",
+ opt_parse_with_commit),
OPT__ABBREV(&abbrev),
OPT_GROUP("Specific git-branch actions:"),
@@ -566,7 +612,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
if (delete)
return delete_branches(argc, argv, force_delete, kinds);
else if (argc == 0)
- print_ref_list(kinds, detached, verbose, abbrev);
+ print_ref_list(kinds, detached, verbose, abbrev, with_commit);
else if (rename && (argc == 1))
rename_branch(head, argv[0], force_rename);
else if (rename && (argc == 2))
--
1.5.3.5.1593.g5baf
^ permalink raw reply related
* Re: Inconsistencies with git log
From: Jon Smirl @ 2007-11-07 23:16 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0711072309380.4362@racer.site>
On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Besides, adding a space and a dot is not what qualifies for "harder to
> use" with this developer.
It requires teaching people new to git to add the space dot.
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: Inconsistencies with git log
From: Brian Gernhardt @ 2007-11-07 23:19 UTC (permalink / raw)
To: Jon Smirl; +Cc: Johannes Schindelin, Git Mailing List
In-Reply-To: <9e4733910711071503va92a653s25fd978989d5917d@mail.gmail.com>
On Nov 7, 2007, at 6:03 PM, Jon Smirl wrote:
> On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>>
>> We also tend to take the approach of viewing the history as that of
>> the whole project.
>
> But if you type 'git log' while cd'd into a subdirectory the whole log
> is almost never what you want. It's this kind of thing that makes git
> harder to use.
Here's where I'd have to disagree with you. If I'm in git.git/
Documentation and am trying to remember which commit I'm trying to
document, suddenly having 90+% of the history vanish would make git
harder to use. Same with my rails projects, my mudlib, etc. Hiding
history is a bad default.
I think the problem is that you're still thinking in the CVS-style per-
file history. "git log" works on the history not the files, so the
automatic filtering simply doesn't make sense. Git's whole-tree
approach makes it much easier to find when Makefile or API changes
have broken your code. But if you know that the error is in a
specific place, then using "." lets you get at it.
However, Dave's suggestion of altering git-status output to be
relative to (but not limited by) CWD has merit. Too bad I don't have
time to work on it right now.
~~ Brian Gernhardt
^ permalink raw reply
* Re: [PATCH 3/3] pretty=format: Avoid some expensive calculations when not needed
From: René Scharfe @ 2007-11-07 23:19 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0711062343050.4362@racer.site>
Johannes Schindelin schrieb:
> Hi,
>
> On Wed, 7 Nov 2007, René Scharfe wrote:
>
>> By the way, the more intrusive surgery required when using strbuf_expand()
>> leads to even faster operation. Here my measurements of most of Paul's
>> test cases (best of three runs):
>>
>> [...]
>
> impressive timings. Although I wonder where the time comes from, as the
> other substitutions should not be _that_ expensive.
I haven't run a profiler, but my two suspects are the malloc()s and
free()s done by interp_set_entry(), and the fact that
format_commit_message() calls interpolate() twice.
> In any case, your approach seems much more sensible, now that we have
> strbuf.
>
>> diff --git a/strbuf.h b/strbuf.h
>> index cd7f295..95071d5 100644
>> --- a/strbuf.h
>> +++ b/strbuf.h
>> @@ -102,6 +102,9 @@ static inline void strbuf_addbuf(struct strbuf *sb, struct strbuf *sb2) {
>> strbuf_add(sb, sb2->buf, sb2->len);
>> }
>>
>> +typedef void (*expand_fn_t) (struct strbuf *sb, const char *placeholder, void *context);
>> +extern void strbuf_expand(struct strbuf *sb, const char *fmt, const char **placeholders, expand_fn_t fn, void *context);
>
> I wonder if it would even faster (but maybe not half as readable) if
> expand_fd_t got the placeholder_index instead of the placeholder.
I doubt it. All this would save is one pointer dereference per
placeholder. I haven't tried and measured this, though.
René
^ permalink raw reply
* Re: [PATCH 3/3] pretty=format: Avoid some expensive calculations when not needed
From: René Scharfe @ 2007-11-07 23:21 UTC (permalink / raw)
To: Pierre Habouzit, Junio C Hamano, Johannes Schindelin, git
In-Reply-To: <20071107001458.GE4382@artemis.corp>
Pierre Habouzit schrieb:
> {
> const char *percent = strchrnul(fmt, '%');
> while (*percent) {
> strbuf_add(sb, fmt, percent - fmt);
> fmt = percent + 1;
>
> /* do your stuff */
>
> percent = strchrnul(fmt, '%');
> }
> strbuf_add(sb, fmt, percent - fmt);
> }
>
>
> Which would require strchrnul, but it's trivial compat/ material for sure.
Grepping through the source I see several places that can be simplified
by converting them to strchrnul(), so I think introducing this GNU
extension is a good idea in any case.
Using strchr()/strchrnul() instead of strbuf_addch()'ing is sensible, of
course. I don't like the duplicate code in your sketch above, though.
I'll try to look into it later today.
Thanks!
René
^ permalink raw reply
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