{"thread":{"id":"5853","subject":"[RFC/PATCH] Enhance core.logallrefupdates","startedAt":"2006-10-08T08:02:45Z","lastAt":"2006-10-08T20:15:06Z","messageCount":4,"participants":["Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"28407","messageId":"7vbqonkzfe.fsf@assigned-by-dhcp.cox.net","threadId":"5853","inReplyTo":null,"subject":"[RFC/PATCH] Enhance core.logallrefupdates","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-08T08:02:45Z","receivedAt":"2006-10-08T08:02:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This enhances core.logallrefupdates by allowing it to take\n\"heads\" as the value as well, which causes git to create missing\nreflog files automatically only for branch heads.  Usually tags\nare create-once-and-live-forever, and it is irritating to see\nreflog files created automatically every time a new tag is made.\n\nAs before, boolean \"true\" means create missing reflog files for\nall refs.\n\n---\n\n * Setting it to \"tags\" is not supported, as it does not make\n   much sense wanting to log only tag updates.\n\n   Come to think of it, it might make sense to change the\n   meaning of \"true\" to do what this patch does.  I do not think\n   of reasons to create missing reflog for tags automatically\n   anyway.\n\n   Opinions?\n\n cache.h  |    2 ++\n config.c |    9 ++++++++-\n refs.c   |    7 ++++++-\n 3 files changed, 16 insertions(+), 2 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 0565333..6029a1d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -186,6 +186,8 @@ extern int use_legacy_headers;\n extern int trust_executable_bit;\n extern int assume_unchanged;\n extern int prefer_symlink_refs;\n+#define REF_LOG_ALL 1\n+#define REF_LOG_HEADS 2\n extern int log_all_ref_updates;\n extern int warn_ambiguous_refs;\n extern int shared_repository;\ndiff --git a/config.c b/config.c\nindex e8f0caf..c254a57 100644\n--- a/config.c\n+++ b/config.c\n@@ -270,7 +270,14 @@ int git_default_config(const char *var, \n \t}\n \n \tif (!strcmp(var, \"core.logallrefupdates\")) {\n-\t\tlog_all_ref_updates = git_config_bool(var, value);\n+\t\tif (!strcasecmp(value, \"heads\"))\n+\t\t\tlog_all_ref_updates = REF_LOG_HEADS;\n+\t\telse if (!strcasecmp(value, \"all\"))\n+\t\t\tlog_all_ref_updates = REF_LOG_ALL;\n+\t\telse if (git_config_bool(var, value))\n+\t\t\tlog_all_ref_updates = REF_LOG_ALL;\n+\t\telse\n+\t\t\tlog_all_ref_updates = 0;\n \t\treturn 0;\n \t}\n \ndiff --git a/refs.c b/refs.c\nindex 305c1a9..fa3c3d7 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -720,8 +720,13 @@ static int log_ref_write(struct ref_lock\n \tunsigned maxlen, len;\n \tchar *logrec;\n \tconst char *committer;\n+\tint create_missing = log_all_ref_updates;\n \n-\tif (log_all_ref_updates) {\n+\tif ((log_all_ref_updates == REF_LOG_HEADS) &&\n+\t    strncmp(lock->ref_name, \"refs/heads/\", 11))\n+\t\tcreate_missing = 0;\n+\n+\tif (create_missing) {\n \t\tif (safe_create_leading_directories(lock->log_file) < 0)\n \t\t\treturn error(\"unable to create directory for %s\",\n \t\t\t\tlock->log_file);\n"},{"id":"28412","messageId":"egaibi$bb$1@sea.gmane.org","threadId":"5853","inReplyTo":"7vbqonkzfe.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC/PATCH] Enhance core.logallrefupdates","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-08T10:03:20Z","receivedAt":"2006-10-08T10:03:20Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> This enhances core.logallrefupdates by allowing it to take\n> \"heads\" as the value as well, which causes git to create missing\n> reflog files automatically only for branch heads.  Usually tags\n> are create-once-and-live-forever, and it is irritating to see\n> reflog files created automatically every time a new tag is made.\n> \n> As before, boolean \"true\" means create missing reflog files for\n> all refs.\n> \n> ---\n> \n>  * Setting it to \"tags\" is not supported, as it does not make\n>    much sense wanting to log only tag updates.\n> \n>    Come to think of it, it might make sense to change the\n>    meaning of \"true\" to do what this patch does.  I do not think\n>    of reasons to create missing reflog for tags automatically\n>    anyway.\n\nIf we change meaning of \"true\", perhaps (just in case in case) we\nshould add \"all\" value?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"28428","messageId":"7vr6xiio02.fsf@assigned-by-dhcp.cox.net","threadId":"5853","inReplyTo":"egaibi$bb$1@sea.gmane.org","subject":"Re: [RFC/PATCH] Enhance core.logallrefupdates","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-08T19:52:29Z","receivedAt":"2006-10-08T19:52:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n>>    Come to think of it, it might make sense to change the\n>>    meaning of \"true\" to do what this patch does.  I do not think\n>>    of reasons to create missing reflog for tags automatically\n>>    anyway.\n>\n> If we change meaning of \"true\", perhaps (just in case in case) we\n> should add \"all\" value?\n\nDidn't I just say that I do not think of reasons to do so ;-)?\n\nSaying \"just in case\" is not enough.  You need to say at least\n\"this hypothetical workflow which requires to update refs/xxx\nand doing automated reflog creation only under refs/heads makes\nthat workflow less convenient\".\n"},{"id":"28432","messageId":"egbm6h$7mu$1@sea.gmane.org","threadId":"5853","inReplyTo":"7vr6xiio02.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC/PATCH] Enhance core.logallrefupdates","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-08T20:15:06Z","receivedAt":"2006-10-08T20:15:06Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>>>    Come to think of it, it might make sense to change the\n>>>    meaning of \"true\" to do what this patch does.  I do not think\n>>>    of reasons to create missing reflog for tags automatically\n>>>    anyway.\n>>\n>> If we change meaning of \"true\", perhaps (just in case in case) we\n>> should add \"all\" value?\n> \n> Didn't I just say that I do not think of reasons to do so ;-)?\n> \n> Saying \"just in case\" is not enough.  You need to say at least\n> \"this hypothetical workflow which requires to update refs/xxx\n> and doing automated reflog creation only under refs/heads makes\n> that workflow less convenient\".\n\nIf I remember correctly there was example of workflow which did\nfetch remote heads to local tags. But I'm not sure if this reflog \nmade sense with that workflow. \n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}