From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Allow the ident attribute to include a length specifier
Date: Mon, 14 May 2007 14:05:29 +0100 [thread overview]
Message-ID: <200705141405.29550.andyparkins@gmail.com> (raw)
When the ident attribute is found for a path, then git replaces $ident$
with:
$ident: df2a1fd3ebce86876721bd7e12ce02ac89c885db $
With this patch, you can put the following in your attribute file:
somepath ident=10
And get expansions like this:
$ident: df2a1fd3eb $
There is no change to existing behaviour. With no parameter, the
expansion is all 40 hex digits.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
convert.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/convert.c b/convert.c
index 9ee31b0..79dfbcf 100644
--- a/convert.c
+++ b/convert.c
@@ -534,8 +534,8 @@ static char *ident_to_worktree(const char *path, const char *src, unsigned long
memcpy(dst, "ident: ", 7);
dst += 7;
- memcpy(dst, sha1_to_hex(sha1), 40);
- dst += 40;
+ memcpy(dst, sha1_to_hex(sha1), ident);
+ dst += ident;
*dst++ = ' ';
size -= (cp - src);
src = cp;
@@ -580,7 +580,13 @@ static int git_path_check_ident(const char *path, struct git_attr_check *check)
{
const char *value = check->value;
- return !!ATTR_TRUE(value);
+ if( ATTR_UNSET(value) || ATTR_FALSE(value) )
+ return 0;
+
+ if( ATTR_TRUE(value) )
+ return 40;
+
+ return atoi(value);
}
char *convert_to_git(const char *path, const char *src, unsigned long *sizep)
--
1.5.2.rc3.27.g43d151-dirty
next reply other threads:[~2007-05-14 13:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 13:05 Andy Parkins [this message]
2007-05-14 13:29 ` [PATCH] Allow the ident attribute to include a length specifier Andy Parkins
2007-05-14 13:37 ` [PATCH] Use $Id$ as the ident attribute keyword rather than $ident$ to be consistent with other VCSs Andy Parkins
2007-05-14 14:19 ` Johannes Sixt
2007-05-14 14:39 ` Andy Parkins
2007-05-14 14:54 ` Junio C Hamano
2007-05-14 22:24 ` Andy Parkins
2007-05-15 0:17 ` Junio C Hamano
2007-05-15 2:03 ` Junio C Hamano
2007-05-15 8:14 ` Andy Parkins
2007-05-15 8:54 ` Junio C Hamano
2007-05-15 10:34 ` Andy Parkins
2007-05-17 13:53 ` [PATCH] Allow the ident attribute to include a length specifier Andy Parkins
2007-05-17 19:55 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200705141405.29550.andyparkins@gmail.com \
--to=andyparkins@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).