Skip to contentSkip to conversation

Trial git RPM's..

PATCH In review Linus Torvalds 7 participants 26 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

Ok, I tagged a "v0.99" thing, and pushed it out. I've also made trial RPM's of it: src, ppc64 and x86. They're build on whatever random machines I had, and on the ppc64 I chose to do it on my FC4 machine that has newer libraries than my YDL one. The x86 thing is FC3, I do believe.

I haven't really verified the RPM's in any other way than a trial installation on one machine, and "gitk" seemed to work. Whoop. The idea being that this is a good way to check whether the rpm target works, _and_ cogito can have something to build against.

They rpm's are at

http://www.kernel.org/pub/software/scm/git/

or will be once mirrored.

Linus

#1 lore raw
Quoted 9 lines · Linus Torvalds

Ok, I tagged a "v0.99" thing, and pushed it out. I've also made trial RPM's of it: src, ppc64 and x86. They're build on whatever random machines I had, and on the ppc64 I chose to do it on my FC4 machine that has newer libraries than my YDL one. The x86 thing is FC3, I do believe.

I haven't really verified the RPM's in any other way than a trial installation on one machine, and "gitk" seemed to work. Whoop. The idea being that this is a good way to check whether the rpm target works, _and_ cogito can have something to build against.

A couple of pieces. The dist target has assumes git-tar-tree is in the path. Making it so you have to have git installed to build the rpm.

The man pages are not built. The build dependencies do not call out the tools necessary to build the man pages.

And it does not pass my torture test of building rpm's on debian, but that is not a huge problem.

Are you still up for a patch that records who and when made a tag? I sent one but it seems to have been lost.

Eric

#2 lore raw
Quoted 7 lines · * Eric W. Biederman ([email protected]) wrote:
Quoted 5 lines · Linus Torvalds

Ok, I tagged a "v0.99" thing, and pushed it out. I've also made trial RPM's of it: src, ppc64 and x86. They're build on whatever random machines I had, and on the ppc64 I chose to do it on my FC4 machine that has newer libraries than my YDL one. The x86 thing is FC3, I do believe.

Quoted 7 lines
Quoted 4 lines

I haven't really verified the RPM's in any other way than a trial installation on one machine, and "gitk" seemed to work. Whoop. The idea being that this is a good way to check whether the rpm target works, _and_ cogito can have something to build against.

A couple of pieces. The dist target has assumes git-tar-tree is in the path. Making it so you have to have git installed to build the rpm.

Known, and was a reasonable assumption in my environment. It's simple bootstrapping issue.

Quoted 2 lines

The man pages are not built. The build dependencies do not call out the tools necessary to build the man pages.

That was rather intentional, because the asciidoc package is not common.

thanks,
-chris

#3 lore raw
In reply to Eric W. Biederman
Quoted 3 lines · Eric W. Biederman

A couple of pieces. The dist target has assumes git-tar-tree is in the path. Making it so you have to have git installed to build the rpm.

Yes. Maybe we could relax that requirement by using "./git-tar-tree" or something? That still requires that you have _built_ git to do the rpm, but at least you won't have had to install it.

Does that fit the rpm build process? Or does an rpm build make something like that really inconvenient? I don't know, patches welcome.

Quoted 2 lines

The man pages are not built. The build dependencies do not call out the tools necessary to build the man pages.

Most people don't have asciidoc, and I'm not sure we want to require it. Maybe we could have a separate "make man-rpm" target for that?

Quoted 2 lines

And it does not pass my torture test of building rpm's on debian, but that is not a huge problem.

Ok, why is debian problematic? Is there some missing dependency or something? I really haven't ever done an rpm, and the git rpm target was all done by Chris Wright, so I don't have any clue at all. Again, patches welcome.

Quoted 2 lines

Are you still up for a patch that records who and when made a tag? I sent one but it seems to have been lost.

I'd really actually prefer for the code to be shared with the commit code, so that the user info (name, email, date) would not just be exactly the same, but would share the same code so that we don't end up having them ever get out of sync.

That would imply moving parts of "git-tag-script" into mktag.c.

Linus

#4 lore raw
Quoted 11 lines · * Linus Torvalds ([email protected]) wrote:
Quoted 3 lines · Eric W. Biederman

A couple of pieces. The dist target has assumes git-tar-tree is in the path. Making it so you have to have git installed to build the rpm.

Yes. Maybe we could relax that requirement by using "./git-tar-tree" or something? That still requires that you have _built_ git to do the rpm, but at least you won't have had to install it.

Does that fit the rpm build process? Or does an rpm build make something like that really inconvenient? I don't know, patches welcome.

No, that could be done. It's not the rpmbuild at that point, it's just prepping to do the rpmbuild. It's only an issue for those that are trying to build an rpm directly from the git source and who've never installed git before. Doesn't seem necessary to me, I'm not that fond of it (will even slightly slow down make dist process if it's done from a clean, i.e. make clean, dir), but hey...the trivial patch below does this.

Quoted 7 lines
Quoted 2 lines

And it does not pass my torture test of building rpm's on debian, but that is not a huge problem.

Ok, why is debian problematic? Is there some missing dependency or something? I really haven't ever done an rpm, and the git rpm target was all done by Chris Wright, so I don't have any clue at all. Again, patches welcome.

Heh debian rpm build...I missed that bit in Eric's message. Eric, care to give details?

thanks,
-chris
--

Use git-tar-tree directly from git source during make dist. This handles bootstrap issue with git not being installed.

---

Makefile +2 -2
@@ -175,8 +175,8 @@ git.spec: git.spec.in
 	sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
 
 GIT_TARNAME=git-$(GIT_VERSION)
-dist: git.spec
-	git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
+dist: git.spec git-tar-tree
+	./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
 	@mkdir -p $(GIT_TARNAME)
 	@cp git.spec $(GIT_TARNAME)
 	tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git.spec
#5 lore raw
Quoted 11 lines · Chris Wright
Quoted 7 lines · * Linus Torvalds ([email protected]) wrote:
Quoted 2 lines

And it does not pass my torture test of building rpm's on debian, but that is not a huge problem.

Ok, why is debian problematic? Is there some missing dependency or something? I really haven't ever done an rpm, and the git rpm target was all done by Chris Wright, so I don't have any clue at all. Again, patches welcome.

Heh debian rpm build...I missed that bit in Eric's message. Eric, care to give details?

Ok paged back in my state. The practical problem is that rpmbuild try to lookup the build dependencies which simply aren't present on debian. Patch will be along shortly once I get the glitches fixed.

One last issue with building packages. Some distros are still shipping GNU interactive tools so git as a package name for the rpm is problematic. At the very least it is extremely confusing that git-0.99 is a more recent package that git-4.3.20.

Eric

#6 lore raw
Quoted 5 lines · Eric W. Biederman

One last issue with building packages. Some distros are still shipping GNU interactive tools so git as a package name for the rpm is problematic. At the very least it is extremely confusing that git-0.99 is a more recent package that git-4.3.20.

Ahh. Dang, I should have remembered this. We should call the rpm "git-core-0.99", not just "git-0.99".

Chris, I assume this is just changing the name in the spec-file from "git" to "git-core"?

Linus

#7 lore raw
Quoted 5 lines · Linus Torvalds

Ahh. Dang, I should have remembered this. We should call the rpm "git-core-0.99", not just "git-0.99".

Chris, I assume this is just changing the name in the spec-file from "git" to "git-core"?

The name of the tarball needs to be updated as well.

Eric

#8 lore raw
Quoted 2 lines · Eric W. Biederman

The name of the tarball needs to be updated as well.

Yes, I noticed.

I ended up renaming the spec-file too.

Pushed out,

Linus

#9 lore raw
Quoted 8 lines · * Linus Torvalds ([email protected]) wrote:
Quoted 1 line · Eric W. Biederman

The name of the tarball needs to be updated as well.

Yes, I noticed.

I ended up renaming the spec-file too.

Pushed out,

Yup, looks good.
-chris

#10 lore raw
In reply to Linus Torvalds
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Eric W. Biederman

A couple of pieces. The dist target has assumes git-tar-tree is in the path. Making it so you have to have git installed to build the rpm.

Yes. Maybe we could relax that requirement by using "./git-tar-tree" or something? That still requires that you have _built_ git to do the rpm, but at least you won't have had to install it.

I don't see a problem here. Sure, you need git to build git, so place it in
Build-requires: Need to install the binary to build the next from source, that's all. Just like gcc ;-)

[...]

Quoted 5 lines
Quoted 2 lines

The man pages are not built. The build dependencies do not call out the tools necessary to build the man pages.

Most people don't have asciidoc, and I'm not sure we want to require it. Maybe we could have a separate "make man-rpm" target for that?

Would have to be a requirement for building anyway. There is a (not really nice) SRPM at <http://www.pvv.ntnu.no/~terjeros/rpms/asciidoc/>. Will see to clean it up.

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
#11 lore raw
In reply to Linus Torvalds
Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Eric W. Biederman

A couple of pieces. The dist target has assumes git-tar-tree is in the path. Making it so you have to have git installed to build the rpm.

Yes. Maybe we could relax that requirement by using "./git-tar-tree" or something? That still requires that you have _built_ git to do the rpm, but at least you won't have had to install it.

Does that fit the rpm build process? Or does an rpm build make something like that really inconvenient? I don't know, patches welcome.

That would be sane. The reason I worry about having it installed is that if git-tar-tree changes without building first you will run the old version instead of the new one.

Quoted 5 lines
Quoted 2 lines

The man pages are not built. The build dependencies do not call out the tools necessary to build the man pages.

Most people don't have asciidoc, and I'm not sure we want to require it. Maybe we could have a separate "make man-rpm" target for that?

Or just have a make man target and only require the rpm to use it. You certainly want to require making the man pages when building the rpm. Which means only those people who build rpms or build man pages need asciidoc.

Quoted 4 lines
Quoted 2 lines

And it does not pass my torture test of building rpm's on debian, but that is not a huge problem.

Ok, why is debian problematic?

Mostly because debian is not rpm based. If you are real careful
you can build rpm's on debian. It is almost as bad as complaining
that git does not build on windows with Microsoft's compiler. I was getting a really generic error. I need to look into it deeper to see if is something that is avoidable.

Quoted 4 lines

Is there some missing dependency or
something? I really haven't ever done an rpm, and the git rpm target was all done by Chris Wright, so I don't have any clue at all. Again, patches welcome.

Will do.

Eric

#12 lore raw
In reply to Linus Torvalds
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Eric W. Biederman

Are you still up for a patch that records who and when made a tag? I sent one but it seems to have been lost.

I'd really actually prefer for the code to be shared with the commit code, so that the user info (name, email, date) would not just be exactly the same, but would share the same code so that we don't end up having them ever get out of sync.

Sounds fair.

Quoted 1 line

That would imply moving parts of "git-tag-script" into mktag.c.

Actually I was looking at doing a git-ident thing that will just compute who git thinks you are. And then git-commit-tree can just popen it to share code. That looks like how the logic has been accomplished in other places.

Moving parts of git-tag-script into mktag is hard because you have to generate a flat file to pass to gpg. And I don't think I am ready to hard code the call to gpg into mktag, as some other signing method may come along. Although that may be the saner choice.

Anyway the git-ident thing is easy and informative for debugging so I will finish coding that up as soon as I get home.

Eric

#13 lore raw
Quoted 5 lines · Eric W. Biederman

Actually I was looking at doing a git-ident thing that will just compute who git thinks you are. And then git-commit-tree can just popen it to share code. That looks like how the logic has been accomplished in other places.

I hate popen() if there's a reasonable functional interface in a library.

popen() is damn inefficient for doing something like this that is all C anyway.

Linus

#14 lore raw
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Eric W. Biederman

Actually I was looking at doing a git-ident thing that will just compute who git thinks you are. And then git-commit-tree can just popen it to share code. That looks like how the logic has been accomplished in other places.

I hate popen() if there's a reasonable functional interface in a library. popen() is damn inefficient for doing something like this that is all C anyway.

Ok two new files then. The new library function, and then the utility that calls it.

Eric

#15 lore raw

PATCH 1/1 tagger id

In reply to Linus Torvalds

This patch adds a command git-id for use on
the command line to see what git will set your id too, and for use in scripts (git-tag-script) so they can get your git id.

The common code for computing the git-id is moved to ident.c

Fix parse_date to not mind being passed a constant date to parse.

The code to compute the identifier has been restructured to at least make a reasonable stab at error handling. The original version had so many unchecked return values it was just scary to think about.

Eric

Makefile +2 -2
@@ -47,7 +47,7 @@ PROG=   git-update-cache git-diff-files 
 	git-diff-stages git-rev-parse git-patch-id git-pack-objects \
 	git-unpack-objects git-verify-pack git-receive-pack git-send-pack \
 	git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
-	git-show-index
+	git-show-index git-id
 
 all: $(PROG)
 
@@ -57,7 +57,7 @@ install: $(PROG) $(SCRIPTS)
 
 LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
 	 tag.o date.o index.o diff-delta.o patch-delta.o entry.o path.o \
-	 epoch.o refs.o csum-file.o pack-check.o pkt-line.o connect.o
+	 epoch.o refs.o csum-file.o pack-check.o pkt-line.o connect.o ident.o
 LIB_FILE=libgit.a
 LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h \
 	pack.h pkt-line.h refs.h
cache.h +6 -1
@@ -208,9 +208,14 @@ extern void *read_object_with_reference(
 					unsigned char *sha1_ret);
 
 const char *show_date(unsigned long time, int timezone);
-void parse_date(char *date, char *buf, int bufsize);
+void parse_date(const char *date, char *buf, int bufsize);
 void datestamp(char *buf, int bufsize);
 
+int git_ident(char *buf, size_t bufsize,
+	const char *env_name, const char *env_email, const char *env_date);
+int git_committer_ident(char *buf, size_t bufsize);
+int git_author_ident(char *buf, size_t bufsize);
+
 static inline void *xmalloc(size_t size)
 {
 	void *ret = malloc(size);
commit-tree.c +12 -70

119 lines not on this page · raw message

date.c +4 -4
@@ -224,7 +224,7 @@ static int is_date(int year, int month, 
 	return 0;
 }
 
-static int match_multi_number(unsigned long num, char c, char *date, char *end, struct tm *tm)
+static int match_multi_number(unsigned long num, char c, const char *date, char *end, struct tm *tm)
 {
 	long num2, num3;
 
@@ -270,7 +270,7 @@ static int match_multi_number(unsigned l
 /*
  * We've seen a digit. Time? Year? Date? 
  */
-static int match_digit(char *date, struct tm *tm, int *offset, int *tm_gmt)
+static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt)
 {
 	int n;
 	char *end;
@@ -361,7 +361,7 @@ static int match_digit(char *date, struc
 	return n;
 }
 
-static int match_tz(char *date, int *offp)
+static int match_tz(const char *date, int *offp)
 {
 	char *end;
 	int offset = strtoul(date+1, &end, 10);
@@ -388,7 +388,7 @@ static int match_tz(char *date, int *off
 
 /* Gr. strptime is crap for this; it doesn't have a way to require RFC2822
    (i.e. English) day/month names, and it doesn't work correctly with %z. */
-void parse_date(char *date, char *result, int maxlen)
+void parse_date(const char *date, char *result, int maxlen)
 {
 	struct tm tm;
 	int offset, sign, tm_gmt;
git-tag-script +3 -1
@@ -7,6 +7,7 @@ name="$1"
 
 object=${2:-$(cat "$GIT_DIR"/HEAD)}
 type=$(git-cat-file -t $object) || exit 1
+tagger=$(git-id) || exit 1
 
 ( echo "#"
   echo "# Write a tag message"
@@ -17,8 +18,9 @@ grep -v '^#' < .editmsg | git-stripspace
 
 [ -s .tagmsg ] || exit
 
-( echo -e "object $object\ntype $type\ntag $name\n"; cat .tagmsg ) > .tmp-tag
+( echo -e "object $object\ntype $type\ntag $name\ntagger $tagger\n"; cat .tagmsg ) > .tmp-tag
 rm -f .tmp-tag.asc .tagmsg
 gpg -bsa .tmp-tag && cat .tmp-tag.asc >> .tmp-tag
+mkdir -p "$GIT_DIR/refs/tags"
 git-mktag < .tmp-tag > "$GIT_DIR/refs/tags/$name"
 #rm .tmp-tag .tmp-tag.sig
id.c new file +36 -0
new file mode 100644
@@ -0,0 +1,36 @@
+#include "cache.h"
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+static char *id_usage = "git-id [--author | --committer]";
+
+int main(int argc, char **argv)
+{
+	char buf[1000];
+	int (*ident)(char *buf, size_t bufsize);
+	int i;
+
+	ident = git_committer_ident;
+	for(i = 1; i < argc; i++) {
+		char *arg = argv[i];
+		if (strcmp(arg, "--author") == 0) {
+			ident = git_author_ident;
+		}
+		else if (strcmp(arg, "--committer") == 0) {
+			ident = git_committer_ident;
+		}
+		else {
+			usage(id_usage);
+		}
+	}
+
+
+	if (ident(buf, sizeof(buf)) < 0) {
+		die("Cannot resolve ident: %s\n", strerror(errno));
+	}
+
+	printf("%s\n", buf);
+
+	return 0;
+}
ident.c new file +144 -0

144 lines not on this page · raw message

mktag.c +8 -2
@@ -42,7 +42,7 @@ static int verify_tag(char *buffer, unsi
 	int typelen;
 	char type[20];
 	unsigned char sha1[20];
-	const char *object, *type_line, *tag_line;
+	const char *object, *type_line, *tag_line, *tagger_line;
 
 	if (size < 64 || size > MAXSIZE-1)
 		return -1;
@@ -92,6 +92,12 @@ static int verify_tag(char *buffer, unsi
 		return -1;
 	}
 
+	/* Verify the tagger line */
+	tagger_line = tag_line;
+	
+	if (memcmp(tagger_line, "tagger", 6) || (tagger_line[6] == '\n'))
+		return -1;
+
 	/* The actual stuff afterwards we don't care about.. */
 	return 0;
 }
@@ -119,7 +125,7 @@ int main(int argc, char **argv)
 		size += ret;
 	}
 
-	// Verify it for some basic sanity: it needs to start with "object <sha1>\ntype "
+	// Verify it for some basic sanity: it needs to start with "object <sha1>\ntype\ntagger "
 	if (verify_tag(buffer, size) < 0)
 		die("invalid tag signature file");
 
#16 lore raw

Re: [PATCH] tagger id

Quoted 6 lines · [email protected] (Eric W. Biederman) writes:

This patch adds a command git-id for use on
the command line to see what git will set your id too, and for use in scripts (git-tag-script) so they can get your git id.

The common code for computing the git-id is moved to ident.c

Quoted 7 lines

Fix parse_date to not mind being passed a constant date to parse.

The code to compute the identifier has been restructured to at least make a reasonable stab at error handling. The original version had so many unchecked return values it was just scary to think about.

Well except for a small bug, but serious bug...

commit-tree.c int main(int argc, char **argv) · line 132

Quoted 13 lines
commit-tree.c +2 -2
@@ -184,8 +126,8 @@ int main(int argc, char **argv)
 		add_buffer(&buffer, &size, "parent %s\n",
 sha1_to_hex(parent_sha1[i]));
 
 	/* Person/date information */
-	add_buffer(&buffer, &size, "author %s <%s> %s\n", gecos, email, date);
- add_buffer(&buffer, &size, "committer %s <%s> %s\n\n", commitgecos,
 commitemail, realdate);
+	add_buffer(&buffer, &size, "author %s <%s> %s\n", author);
+	add_buffer(&buffer, &size, "committer %s <%s> %s\n\n", committer);

This should be:

Quoted 15 lines
commit-tree.c +2 -0
+	add_buffer(&buffer, &size, "author %s\n", author);
+	add_buffer(&buffer, &size, "committer %s\n\n", committer);
 
 
 	/* And add the comment */
 	while (fgets(comment, sizeof(comment), stdin) != NULL)
id.c new file +4 -0
new file mode 100644
@@ -0,0 +1,36 @@
+#include "cache.h"
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>

id.c line 14

Quoted 10 lines
id.c new file +10 -0
+
+static char *id_usage = "git-id [--author | --committer]";
+
+int main(int argc, char **argv)
+{
+	char buf[1000];
+	int (*ident)(char *buf, size_t bufsize);
+	int i;
+
+	ident = git_committer_ident;

Should this default to git_author_ident or git_committer_ident? I'm not really certain how we expect to use the different flavors.

Eric

#17 lore raw

Re: [PATCH] tagger id

Quoted 2 lines · [email protected] (Eric W. Biederman) writes:

Should this default to git_author_ident or git_committer_ident? I'm not really certain how we expect to use the different flavors.

The only in-tree user after your patch is applied is the tagger stuff, so in that sense committer_ident may make more sense. Having said that, for something like this that would not be used constantly and interatively by the users, my preference is not to have any default at all, and always require --author or --committer. You have to type a bit more when doing the script, but that needs to be done only once. You will be sure which one you are asking from the command two weeks after you wrote the script so it is not a big loss.

I am not seriously suggesting the below as an alternative, but have you thought about doing an inverse function of your computation for the case when the user has all the environment variables, and have script eval its output, like this [*1*]:

    $ git-id
    GIT_AUTHOR_NAME='Junio C Hamano'
    GIT_AUTHOR_EMAIL='[email protected]'
    GIT_COMMITTER_NAME='Junio C Hamano'
    GIT_COMMITTER_EMAIL='[email protected]'
    $ eval "`git-id`"
    $ tagger="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"

Having names and emails available separately may turn out to be easier to use in other situation. Just a thought.

By the way, I do not particularly like the name "git-id". There could be IDs for different kinds (not just people) we would want later (file IDs, for example). Naming what you are computing _the_ "id" feels a bit too generic. I do not have a better alternative to suggest, though.

[Footnote]

*1* This makes its output syntax a bit too specific to the shell and unfriendly to Porcelain written in other languages. The only non-shell Porcelains I am aware of are done in Perl (I do not remember hearing its name) and Python (StGIT), both of which have reasonable regexp support to grok something like this, so it would not be a big issue.

#18 lore raw

Re: [PATCH] tagger id

Quoted 7 lines · Junio C Hamano
Quoted 2 lines · [email protected] (Eric W. Biederman) writes:

Should this default to git_author_ident or git_committer_ident? I'm not really certain how we expect to use the different flavors.

The only in-tree user after your patch is applied is the tagger stuff, so in that sense committer_ident may make more sense.

There is also the commit path, and that comes from C. I'm not quite certain how we should be using the environmental variables.

Quoted 7 lines

Having said that, for something like this that would not be used constantly and interatively by the users, my preference is not to have any default at all, and always require --author or --committer. You have to type a bit more when doing the script, but that needs to be done only once. You will be sure which one you are asking from the command two weeks after you wrote the script so it is not a big loss.

Make sense. Although I'm not quite certain we actually need the information twice. Possibly we just have GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, and then have commit-write take a flag to override the author bit. That would certainly make it less confusing when setting up environmental variables for git. And that would also give us a better name.

Quoted 13 lines

I am not seriously suggesting the below as an alternative, but have you thought about doing an inverse function of your computation for the case when the user has all the environment variables, and have script eval its output, like this [*1*]:

    $ git-id
    GIT_AUTHOR_NAME='Junio C Hamano'
    GIT_AUTHOR_EMAIL='[email protected]'
    GIT_COMMITTER_NAME='Junio C Hamano'
    GIT_COMMITTER_EMAIL='[email protected]'
    $ eval "`git-id`"
    $ tagger="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
Quoted 2 lines

Having names and emails available separately may turn out to be easier to use in other situation. Just a thought.

Part of the request was to put all of this information together in a common place. And note that it is actually:
tagger="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" Where the date is a human unreadable string of the number of seconds since the epoch (aka 1 Jan 1970 UTC).

Quoted 5 lines

By the way, I do not particularly like the name "git-id". There could be IDs for different kinds (not just people) we would want later (file IDs, for example). Naming what you are computing _the_ "id" feels a bit too generic. I do not have a better alternative to suggest, though.

Agreed. Something like git-author or git-author-stamp is probably better.

Quoted 6 lines

*1* This makes its output syntax a bit too specific to the shell and unfriendly to Porcelain written in other languages. The only non-shell Porcelains I am aware of are done in Perl (I do not remember hearing its name) and Python (StGIT), both of which have reasonable regexp support to grok something like this, so it would not be a big issue.

And in git-commit-script this is actually parsed by sed which makes it so the shell can parse the information as well so I think we are fine in that sense.

Eric

#19 lore raw

Re: [PATCH] tagger id

Dear diary, on Tue, Jul 12, 2005 at 05:04:23PM CEST, I got a letter where "Eric W. Biederman" <[email protected]> told me that...

Quoted 8 lines
Quoted 5 lines

By the way, I do not particularly like the name "git-id". There could be IDs for different kinds (not just people) we would want later (file IDs, for example). Naming what you are computing _the_ "id" feels a bit too generic. I do not have a better alternative to suggest, though.

Agreed. Something like git-author or git-author-stamp is probably better.

Since that "infriges" the author/committer distinction, I would prefer git-person-id.

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
<Espy> be careful, some twit might quote you out of context..
#20 lore raw

Re: [PATCH] tagger id

In reply to Eric W. Biederman
Quoted 8 lines · Eric W. Biederman <ebiederm <at> xmission.com> writes:
Quoted 2 lines · Junio C Hamano <junkio <at> cox.net> writes:

The only in-tree user after your patch is applied is the tagger stuff, so in that sense committer_ident may make more sense.

There is also the commit path, and that comes from C. I'm not quite certain how we should be using the environmental variables.

But there you would not have "default" issue, would you?

Quoted 5 lines

Part of the request was to put all of this information together in a common place. And note that it is actually:
tagger="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" Where the date is a human unreadable string of the number of seconds since the epoch (aka 1 Jan 1970 UTC).

This may sound whacy, but how about having git-env command that

(1) parrots GIT_* environment variables if the user has one; or
(2) shows the values of environment variables the user _could_ have had to cause the program to behave the same way, when it the user does not have them?

Synopsis.

  $ git-env [--values-only] [<variable name>...]

Examples.

 $ git-env GIT_COMMITER_DATE GIT_AUTHOR_NAME
 GIT_COMMITTER_DATE='1121202267 -0700'
 GIT_AUTHOR_NAME='Junio C Hamano'
 $ unset GIT_OBJECT_DIRECTORY
 $ GIT_DIR=foo git-env --values-only GIT_OBJECT_DIRECTORY
 foo/objects
 $ git-env
 GIT_DIR=.git
 GIT_OBJECT_DIRECTORY=.git/objects
 ...
 $ eval "`git-env GIT_COMMITTER_DATE GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE`"
 $ tagger="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE"

We could add a couple of "variable name"s that we do _not_ use from the environment as a shorthand as well while we are at it, so that you can say:

 $ git-env GIT_COMMITTER_ID
 GIT_COMMITTER_ID='Junio C Hamano <[email protected]> 1121202267 -0700'

Once we go this route, it may even make sense to have that GIT_COMMITTER_ID environment variable as well. I don't know..

#21 lore raw

Re: [PATCH] tagger id

Quoted 9 lines · Junio C Hamano
Quoted 5 lines · Eric W. Biederman <ebiederm <at> xmission.com> writes:

Part of the request was to put all of this information together in a common place. And note that it is actually:
tagger="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" Where the date is a human unreadable string of the number of seconds since the epoch (aka 1 Jan 1970 UTC).

Quoted 6 lines

This may sound whacy, but how about having git-env command that

(1) parrots GIT_* environment variables if the user has one; or
(2) shows the values of environment variables the user _could_ have had to cause the program to behave the same way, when it the user does not have them?

I like the general idea. But I hate the code implications for echoing environmental variables that git cares about. Especially since we really don't care about the environmental variables. Instead we are doing this because we are doing things that the are best not done in shell.

So I have made the program git-var [ -l | <variable name ]

Without the implicit tying we can just export those values that we find interesting. -l will list all of the variables and their values like env, while specifying an single variable will just read that variables value.

Eric

#22 lore raw

Re: [PATCH] tagger id

In reply to Eric W. Biederman

Eric,
I ended up coding the ident stuff a bit differently, and I didn't do done
the tag/git-id part yet. Can you check out my latest commit (pushed out, but it will probably take a few minutes to mirror out), and do the final tag stuff based on that?

Linus

#23 lore raw

Re: [PATCH] tagger id

Quoted 5 lines · Linus Torvalds

Eric,
I ended up coding the ident stuff a bit differently, and I didn't do done
the tag/git-id part yet. Can you check out my latest commit (pushed out, but it will probably take a few minutes to mirror out), and do the final tag stuff based on that?

For the most part it looks sane. I'm not really thrilled that
setup_ident() calls die, and when complaining about the user name we should probably complain that their sysadmin hated then if it is over a 1000 characters not their parents :)

I'm also not at all thrilled with global variables. Globals aren't the source of all evil but they have a lot better claim than goto. At least real_email and friends are file local. If you like it and the code works git is you project and I won't complain again.

Since we are still looking at this there is one change in the user interface I would like to make to simplify things for the end user. The only time when GIT_COMMITTER != GIT_AUTHOR is in git_commit_script when we you are making a new commit based on an old commit. Can we add a command line option to git-commit-write, --author that will allow the author field to be overridden. Allowing us to get down to a single set of GIT variables for specifying who the user is?

That also simplifies the tagging case and answers the question which environment variables tags should look at, to see who the user is.

Eric

#24 lore raw

Re: [PATCH] tagger id

Quoted 4 lines · Eric W. Biederman <ebiederm <at> xmission.com> writes:

Since we are still looking at this there is one change in the user interface I would like to make to simplify things for the end user. The only time when GIT_COMMITTER != GIT_AUTHOR is in git_commit_script when we you are making a new commit based on an old commit...

I am afraid I do not follow you. For a "project lead" person like Linus, who takes an e-mail submission of patches, GIT_AUTHOR is almost always different from the committer, and typically set up by the program that reads the e-mail to snarf the From: and Date: lines via environment variables, when the incoming patches are being processed. He is saying "I am the COMMITTER, and this commit I am making is written by this AUTHOR".

AUTHOR can be set to somebody other than yourself and that is a typical mode of operation for a "project lead" person.

On the other hand, we made COMMITTER overridable only because (1) the computed value from the system are often not quite right on many systems with weird GECOS field or domain/e-mail setup, and (2) when converting from a foreign SCM, we wanted to keep the committer information (and dates), if available. Only in (2), which is quite a special case, COMMITTER names somebody different from yourself.

What this means is that if you are asking the question "who the user is", the answer _should_ always come from COMMITTER.

Quoted 3 lines

That also simplifies the tagging case and answers the question which environment variables tags should look at, to see who the user is.

The intent of "tags" (especially the signed kind) is to express "trust":
"This commit is called v2.6.12 and *I* vouch for it."

COMMITTER is the only sensible thing to use there, because (as you said) what you care is "who I am", not "for whom I am doing this".

#25 lore raw

Re: [PATCH] tagger id

Quoted 1 line · Junio C Hamano

I am afraid I do not follow you.

I was confused. My big problem was that we don't really have an in tree user, and there wasn't a good explanation anywhere. So it was hard to track this down.

I'm going to lobby for a script to import patches from email being in the git tree just so people can see how this is done, and probably because there are a lot of people who have been reinventing this script :)

Quoted 5 lines

The intent of "tags" (especially the signed kind) is to express "trust":
"This commit is called v2.6.12 and *I* vouch for it."

COMMITTER is the only sensible thing to use there, because (as you said) what you care is "who I am", not "for whom I am doing this"

Sounds good.

Eric