* [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists
@ 2006-09-20 21:25 Johannes Schindelin
2006-09-20 22:46 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2006-09-20 21:25 UTC (permalink / raw)
To: git, junkio
Now, if no tag exists to say something like '<tag>-gfffffff', say
'HEAD-gfffffff' instead of erroring out.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
describe.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/describe.c b/describe.c
index ab192f8..8b08a3f 100644
--- a/describe.c
+++ b/describe.c
@@ -136,7 +136,7 @@ static void describe(const char *arg, in
return;
}
}
- die("cannot describe '%s'", sha1_to_hex(cmit->object.sha1));
+ printf("HEAD-g%s\n", find_unique_abbrev(cmit->object.sha1, abbrev));
}
int main(int argc, char **argv)
--
1.4.2.1.ga0df5-dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists
2006-09-20 21:25 [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists Johannes Schindelin
@ 2006-09-20 22:46 ` Junio C Hamano
2006-09-20 22:53 ` Johannes Schindelin
2006-09-21 7:43 ` Andy Whitcroft
0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2006-09-20 22:46 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, junkio
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Now, if no tag exists to say something like '<tag>-gfffffff', say
> 'HEAD-gfffffff' instead of erroring out.
>
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> ---
> describe.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/describe.c b/describe.c
> index ab192f8..8b08a3f 100644
> --- a/describe.c
> +++ b/describe.c
> @@ -136,7 +136,7 @@ static void describe(const char *arg, in
> return;
> }
> }
> - die("cannot describe '%s'", sha1_to_hex(cmit->object.sha1));
> + printf("HEAD-g%s\n", find_unique_abbrev(cmit->object.sha1, abbrev));
> }
Hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm.
At least with tags, the user can assume NAME-gREV means commit
whose abbrev is REV that is descendant of NAME. HEAD is not
necessarily so.
Having said that, in order to avoid barfing, we have to have
something there, and HEAD is already special in many aspects
anyway (e.g. by only saying HEAD you cannot tell which branch's
tip you are talking about), it might be good enough.
I am just wondering if there is some other obvious substitute
that is better than HEAD. "GIT-g%s" is not it ("g" already
stands for GIT).
Another possibility is just to do
puts(sha1_to_hex(cmit->object.sha1))
in this case. I tend to like that better somehow; it makes
things more explicit.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists
2006-09-20 22:46 ` Junio C Hamano
@ 2006-09-20 22:53 ` Johannes Schindelin
2006-09-21 7:43 ` Andy Whitcroft
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2006-09-20 22:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Wed, 20 Sep 2006, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Now, if no tag exists to say something like '<tag>-gfffffff', say
> > 'HEAD-gfffffff' instead of erroring out.
>
> Another possibility is just to do
>
> puts(sha1_to_hex(cmit->object.sha1))
>
> in this case.
Okay. Could we have the abbreviated sha1, at least?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists
2006-09-20 22:46 ` Junio C Hamano
2006-09-20 22:53 ` Johannes Schindelin
@ 2006-09-21 7:43 ` Andy Whitcroft
1 sibling, 0 replies; 4+ messages in thread
From: Andy Whitcroft @ 2006-09-21 7:43 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> Now, if no tag exists to say something like '<tag>-gfffffff', say
>> 'HEAD-gfffffff' instead of erroring out.
>>
>> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>> ---
>> describe.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/describe.c b/describe.c
>> index ab192f8..8b08a3f 100644
>> --- a/describe.c
>> +++ b/describe.c
>> @@ -136,7 +136,7 @@ static void describe(const char *arg, in
>> return;
>> }
>> }
>> - die("cannot describe '%s'", sha1_to_hex(cmit->object.sha1));
>> + printf("HEAD-g%s\n", find_unique_abbrev(cmit->object.sha1, abbrev));
>> }
>
> Hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm.
>
> At least with tags, the user can assume NAME-gREV means commit
> whose abbrev is REV that is descendant of NAME. HEAD is not
> necessarily so.
>
> Having said that, in order to avoid barfing, we have to have
> something there, and HEAD is already special in many aspects
> anyway (e.g. by only saying HEAD you cannot tell which branch's
> tip you are talking about), it might be good enough.
>
> I am just wondering if there is some other obvious substitute
> that is better than HEAD. "GIT-g%s" is not it ("g" already
> stands for GIT).
>
> Another possibility is just to do
>
> puts(sha1_to_hex(cmit->object.sha1))
>
> in this case. I tend to like that better somehow; it makes
> things more explicit.
Heh, we've just been putting together 'versioner' for some software and
when git-describe fails we substitute in the complete sha1 at that
point. Based mostly on the "who'd release something versioned without
tagging anyhow". I think either the full sha1 or _just_ the gNNNNN
without prefix would be fine.
-apw
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-21 7:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-20 21:25 [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists Johannes Schindelin
2006-09-20 22:46 ` Junio C Hamano
2006-09-20 22:53 ` Johannes Schindelin
2006-09-21 7:43 ` Andy Whitcroft
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).