Re: What's cooking in git.git (Apr 2014, #09; Tue, 29)
On Mon, May 05, 2014 at 04:50:58PM -0700, Junio C Hamano wrote: John Keeping j...@keeping.me.uk writes: Having said all that, there is one caveat. Since the remote helper interface is stable and the remote helpers do not use any of the Git internals, I consider the risks of including them in core Git to outweigh the benefits of wider distribution. You are correct to say that a remote helper has to talk with a foreign system and it would not help to dictate the update schedule of helpers to match the release cycle of Git itself. At the same time, however, the interface the remote helpers use to talk to Git has not been as stable as you seem to think, I am afraid. For example, a recent remote-hg/bzr series needed some enhancements to fast-import to achieve the feature parity with native transports by adding a missing feature or two on the Git side. This doesn't qualify as an unstable interface for me. In this case, the remote helpers could not support a feature without Git supporting it first, which is quite natural and the remote helper can then guard that feature with a capability check. I do not think it likely that the remote helper interface will ever change in such a way that all remote helpers must be updated, at least not without a long deprecation period. The Mercurial API makes no such guarantee; it is considered a private implementation detail and most releases seem to contain some changes that require all consumers to be updated. There is a different level of urgency between you cannot use this new feature until you update Git and if you update Mercurial then the remote helper will stop working, and that's why I think the remote helpers may benefit from a separate release schedule. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] t3910: show failure of core.precomposeunicode with decomposed filenames
On Mon, May 5, 2014 at 11:46 PM, Jeff King p...@peff.net wrote: On Sun, May 04, 2014 at 08:13:15AM +0200, Torsten Bögershausen wrote: 1. Tell everyone that NFD in the git repo is wrong, and they should make a new commit to normalize all their in-repo files to be precomposed. This is probably not the right thing to do, because it still doesn't fix checkouts of old history. And it spreads the problem to people on byte-preserving filesystems (like ext4), because now they have to start precomposing their filenames as they are adde to git. (typo: ^added) I'm not sure if I follow. People running ext4 (or Linux in general, or Windows, or Unix) do not suffer from file system feature of Mac OS, which accepts precomposed/decomposed Unicode but returns decompomsed. What I mean by spreads the problem is that git on Linux does not need to care about utf8 at all. It treats filenames as a byte sequence. But if we were to start enforcing filenames should be precomposed utf8, then people adding files on Linux would want to enforce that, too. People on Linux could ignore the issue as they do now, but they would then create problems for OS X users if they add decomposed filenames. IOW, if the OS X code assumes all repo filenames are precomposed, then other systems become a possible vector for violating that assumption. FWIW, Git for Windows also doesn't deal with that filenames are just a byte-sequence-notion. We have patches in place that require filenames to *either* be valid UTF-8 or Windows-1252. Windows itself treats filenames as Unicode characters, not arbitrary byte sequences. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Summary of the problems with git pull
Hi, There has been a lot of discussion about why `git pull` is broken for so many many workflows: [1][2][3][4][5], even as far back as [6]. Many issues has been brought up, and many proposed solutions, probably too many for most people properly digest them, so here I'll try to synthesize them. Mainly there are two core problems with `git pull`: 1) Many times it does a merge when it's not when people want 2) Many times it does a merge opposite of the desired direction The issue comes in trying to solve these problems in a way that would not affect anybody negatively. The simplest way to fix these issues unobtrusively would be to add configurations for the new behavior. However, this wouldn't solve the problem because as it has been discussed the vast majority of people doing these bad merges are not advanced users, so they wouldn't activate these options. What is needed is to change the default behavior, but in a way that is not obtrusive, and with backwards compatibility configuration. The most concrete proposal is my patch series that puts everything in place to enable fast-forward merged by default only. However, that still doesn't solve the problem of the ordering of parents. Normally these two issues would be independent of each other, but after further analysis I think they are not. == Two different kinds of pulls == It has become clear that the `git pull` command is in fact used to do two very different things: 1) Update the current branch Most people do `git pull` like they would do `svn update`; to update their current branch. 2) Merge a remote branch There are many use-cases of this. The agreement so far is that 1) is the one that is broken, that is; a) by default only fast-forwards should be allowed, and b) when a merge happens the parents should be reverted (merge 'master' to 'origin/master'). It would be possible to differentiate these kinds by saying a `git pull` that doesn't specify the location can be assumed as 1), and a `git pull remote branch` that does as 2). Another possibility is to assume only the upstream branch corresponds to 1). Unfortunately it's the feeling of many people that this solution is not clean, because it's two very different behaviors for the same command. Furthermore even deeper analysis of the use-cases demonstrates there would be a need to have different configurations for the different modes (e.g. pull.updateMode and pull.integrateMode). == git update == Another proposed solution is to have a new command: `git update`. This command would be similar to `git pull --ff-only` by default, but it could be configured to do merges instead, and when doing so in reverse. An interesting side-effect of this new command is that it opens the possibility of thinking about `git update --rebase` vs. `git pull --rebase`. For example: a) git update --merge Merge HEAD into @{upstream} b) git update --rebase Rebase HEAD onto @{upstream} c) git pull --merge github john Merge github/john into HEAD d) git pull --rebase github john Rebase github/john onto HEAD Notice how the relationships between them are nice and consistent. Also, d) was not possible before. This solves essentially all the issues people presented in their use-cases, except the differentiation between merging topic and upstream branches, for which we might want to add different options in `git pull`, but that's independent from the issues I mentioned at the beginning. Nothing changes for the users of `git pull`, except that perhaps we would want --rebase to work in reverse, since the current `git pull --rebase` would already rebase HEAD onto @{upstream}. Personally my next step would be to port the changes I did for pull.mode = merge-ff-only into a new command `git update`, which would probably be a copy-paste from `git pull` and see how that turns out. In addition, when running `git pull` without arguments we might want to add a temporary notice explaining that perhaps the user wanted to type `git update` instead. Cheers. [1] http://article.gmane.org/gmane.comp.version-control.git/233554 [2] http://article.gmane.org/gmane.comp.version-control.git/234295 [3] http://article.gmane.org/gmane.comp.version-control.git/225146 [4] http://article.gmane.org/gmane.comp.version-control.git/247237 [5] http://article.gmane.org/gmane.comp.version-control.git/247939 [6] http://article.gmane.org/gmane.comp.version-control.git/130819 -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git gui error with relocated repository
Chris Packham judge.pack...@gmail.com writes: On Tue, Apr 29, 2014 at 2:56 PM, Chris Packham judge.pack...@gmail.com wrote: Hi Pat, I'm running git 2.0.0-rc0 (haven't got round to pulling down rc1 yet) which includes gitgui-0.19.0 and I'm getting a new error when I run 'git gui' in a repository with a .git file (created by git submodule). I can send you a screencap of the error message off list if you want but the text is No working directory ../../../repo couldn't change working directory to ../../../repo: no such file or directory My tcl is a little rusty but I think the problem might be this snippet. # v1.7.0 introduced --show-toplevel to return the canonical work-tree if {[package vsatisfies $_git_version 1.7.0]} { if { [is_Cygwin] } { catch {set _gitworktree [exec cygpath --windows [git rev-parse --show-toplevel]]} } else { set _gitworktree [git rev-parse --show-toplevel] } } else { # try to set work tree from environment, core.worktree or use # cdup to obtain a relative path to the top of the worktree. If # run from the top, the ./ prefix ensures normalize expands pwd. if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} { set _gitworktree [get_config core.worktree] if {$_gitworktree eq } { set _gitworktree [file normalize ./[git rev-parse --show-cdup]] } } } The vsatisfies call probably doesn't handle '2.0.0.rc0' and the fallback behaviour probably needs to normalise core.worktree The _git_version variable has already been trimmed to remove such suffixes so the version comparison here will be ok. It looks more likely to be something to do with the .git being a file with a link being mishandled. How did you setup this test repository with its link to a parent? Here's some other info that might help $ git --version git version 2.0.0.rc0 $ cat .git gitdir: ../.git/modules/repo $ git rev-parse --git-dir /home/chris/src/super/.git/modules/repo $ git config core.worktree ../../../repo Thanks, Chris -- Pat Thoytshttp://www.patthoyts.tk/ PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
read-tree bug
Hello! I have some troubles with git command ³read-tree². I have big project and I try to add shared library to subdirectory. So I made the following in my project (on master) git remote add g...@bitbucket.org:ijin1984/groundwork.git git fetch groundwork git checkout b gwbranch groundwork/master git checkout master git read-tree --prefix=mb/trunk/src/ru.uralsib.dbo.client.iphone/libs/ -u gwbranch git commit m ³add groundwork to libs² After that I make small change in one file inside libs (for example in mb/trunk/src/ru.uralsib.dbo.client.iphone/libs/groundwork/notes.txt² and commit with git commit a m ³test commit² Then I made: git checkout gwbranch git merge --squash -s subtree --no-commit master And after this instead of merging I find the whole main project in subdir ³groundwork/Groundwork/Base.lproj². If I do the 5-th command with ‹prefix option value equal to for example ³libs² tether than something like ³subdir/subsubdir/Š/libs² - all works fine. I think that it is bag, because I experimented quite a lot with deferrent values. I think that problem in directory name with dots, i.e. ru.uralsib.dbo.client.iphone². Could you please help me with this issue. If you need to add some more info about this case I will provide. Thanks in advance. Best regards, Eugene Klishevich iOS-developer skype: eugene.klishevich -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/5] contrib/subtree/Makefile: Standardisation pass
On 6 May 2014 08:01, Jeff King p...@peff.net wrote: [fixed David's address in cc list] Ah, right. Wasn't sure what was going on there. On Tue, May 06, 2014 at 07:54:30AM +1000, James Denholm wrote: Given that subtree subtree doesn't really generate a lot of discussion, would it be advisable to wrap this up (barring further discussion) and send it off to Junio rather than waiting for further community consensus? I do not know if lack of discussion is a good reason to consider something in good shape; oftentimes it is a sign that nobody is interested in the area. We usually rely on area maintainers to give an OK to the patches if they are not something that the maintainer himself has an interest in. Yeah, I certainly only meant that in the context of this particular patch, post-review. However, in this case, you did get review, and I think it is pretty easy to see the patches are good even if one does not care about the particular area. So I think they are fine to pass on and apply. Sounds good, I'll send it on up now. Thanks again for the help. Note also that patches like this are a great place to get started, as they help build trust in a contributor, who can later help out with area maintenance. Yeah, to be honest, beyond the immediate goal of getting subtree in more distros, that is kinda the plan. A bit of a practical experience in contributing to the project, learning the specific ropes and such before proposing more substantial discussion and fixes/changes. --- Regards, James Denholm. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/5] contrib/subtree/Makefile: clean rule cleanup
git:Documentation/Makefile and others establish RM ?= rm -f as a convention for rm calls in clean rules, hence follow this convention instead of simply forcing clean to use rm. subproj and mainline no longer need to be removed in clean, as they are no longer created in git:contrib/subtree by make test. Hence, remove the rm call for those folders. Other makefiles don't remove *~ files, remove the rm call to prevent unexpected behaviour in the future. Similarly, clean doesn't remove the installable file, so rectify this. Reviewed-by: Jeff King p...@peff.net Signed-off-by: James Denholm nod.h...@gmail.com --- contrib/subtree/Makefile | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile index f3834b5..d888d45 100644 --- a/contrib/subtree/Makefile +++ b/contrib/subtree/Makefile @@ -12,7 +12,8 @@ man1dir ?= $(mandir)/man1 -include ../../GIT-VERSION-FILE # this should be set to a 'standard' bsd-type install program -INSTALL ?= install +INSTALL ?= install +RM ?= rm -f ASCIIDOC = asciidoc XMLTO= xmlto @@ -60,7 +61,7 @@ test: $(MAKE) -C t/ test clean: - rm -f *~ *.xml *.html *.1 - rm -rf subproj mainline + $(RM) $(GIT_SUBTREE) + $(RM) *.xml *.html *.1 .PHONY: FORCE -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/5] contrib/subtree/Makefile: Use GIT-VERSION-FILE
GVF is already being used in most/all other makefiles in the project, and has been for _quite_ a while. Hence, drop file-unique gitver and replace with GIT_VERSION. Reviewed-by: Jeff King p...@peff.net Signed-off-by: James Denholm nod.h...@gmail.com --- contrib/subtree/Makefile | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile index 87797ed..f63334b 100644 --- a/contrib/subtree/Makefile +++ b/contrib/subtree/Makefile @@ -6,7 +6,10 @@ mandir ?= $(prefix)/share/man libexecdir ?= $(prefix)/libexec/git-core man1dir ?= $(mandir)/man1 -gitver ?= $(word 3,$(shell git --version)) +../../GIT-VERSION-FILE: FORCE + $(MAKE) -C ../../ GIT-VERSION-FILE + +-include ../../GIT-VERSION-FILE # this should be set to a 'standard' bsd-type install program INSTALL ?= install @@ -44,11 +47,11 @@ $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML) $(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT) asciidoc -b docbook -d manpage -f $(ASCIIDOC_CONF) \ - -agit_version=$(gitver) $^ + -agit_version=$(GIT_VERSION) $^ $(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT) asciidoc -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \ - -agit_version=$(gitver) $^ + -agit_version=$(GIT_VERSION) $^ test: $(MAKE) -C t/ test @@ -56,3 +59,5 @@ test: clean: rm -f *~ *.xml *.html *.1 rm -rf subproj mainline + +.PHONY: FORCE -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/5] contrib/subtree/Makefile: s/libexecdir/gitexecdir
$(libexecdir) isn't used anywhere else in the project, while $(gitexecdir) is the standard in the other appropriate makefiles. Hence, replace the former with the latter. Reviewed-by: Jeff King p...@peff.net Signed-off-by: James Denholm nod.h...@gmail.com --- contrib/subtree/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile index f63334b..579bb51 100644 --- a/contrib/subtree/Makefile +++ b/contrib/subtree/Makefile @@ -3,7 +3,7 @@ prefix ?= /usr/local mandir ?= $(prefix)/share/man -libexecdir ?= $(prefix)/libexec/git-core +gitexecdir ?= $(prefix)/libexec/git-core man1dir ?= $(mandir)/man1 ../../GIT-VERSION-FILE: FORCE @@ -33,8 +33,8 @@ $(GIT_SUBTREE): $(GIT_SUBTREE_SH) doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML) install: $(GIT_SUBTREE) - $(INSTALL) -d -m 755 $(DESTDIR)$(libexecdir) - $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(libexecdir) + $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir) + $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir) install-doc: install-man -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/5] contrib/subtree/Makefile: Doc-gen rules cleanup
git:Documentation/Makefile establishes asciidoc/xmlto calls as being handled through their appropriate variables, Hence, change to bring into congruency with. Similarly, MANPAGE_XSL exists in git:Documentation/Makefile, while MANPAGE_NORMAL_XSL does not outside contrib/subtree. Hence, replace MANPAGE_NORMAL_XSL with MANPAGE_XSL. Reviewed-by: Jeff King p...@peff.net Signed-off-by: James Denholm nod.h...@gmail.com --- contrib/subtree/Makefile | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile index 579bb51..f3834b5 100644 --- a/contrib/subtree/Makefile +++ b/contrib/subtree/Makefile @@ -14,8 +14,11 @@ man1dir ?= $(mandir)/man1 # this should be set to a 'standard' bsd-type install program INSTALL ?= install -ASCIIDOC_CONF = ../../Documentation/asciidoc.conf -MANPAGE_NORMAL_XSL = ../../Documentation/manpage-normal.xsl +ASCIIDOC = asciidoc +XMLTO= xmlto + +ASCIIDOC_CONF = ../../Documentation/asciidoc.conf +MANPAGE_XSL = ../../Documentation/manpage-normal.xsl GIT_SUBTREE_SH := git-subtree.sh GIT_SUBTREE:= git-subtree @@ -43,14 +46,14 @@ install-man: $(GIT_SUBTREE_DOC) $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir) $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML) - xmlto -m $(MANPAGE_NORMAL_XSL) man $^ + $(XMLTO) -m $(MANPAGE_XSL) man $^ $(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT) - asciidoc -b docbook -d manpage -f $(ASCIIDOC_CONF) \ + $(ASCIIDOC) -b docbook -d manpage -f $(ASCIIDOC_CONF) \ -agit_version=$(GIT_VERSION) $^ $(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT) - asciidoc -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \ + $(ASCIIDOC) -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \ -agit_version=$(GIT_VERSION) $^ test: -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/5] contrib/subtree/Makefile: Standardisation pass
contrib/subtree/Makefile is a shambles in regards to it's consistency with other makefiles, which makes subtree overly painful to include in build scripts. The main issues are that calls are made to git itself in the build process, and that a subtree-exclusive variable is used for specifying the exec path. Patches 1/5 through 3/5 resolve these. The cleanup fixes (4/5 and 5/5) are based on precedents set by other makefiles across the project. One problem is foreseen: 3/5 will necessitate that package maintainers who already have git-subtree included in their packages update their build-scripts. Reviewed-by: Jeff King p...@peff.net Signed-off-by: James Denholm nod.h...@gmail.com Based-on-patch-by: Dan McGee dpmc...@gmail.com James Denholm (5): contrib/subtree/Makefile: scrap unused $(gitdir) contrib/subtree/Makefile: Use GIT-VERSION-FILE contrib/subtree/Makefile: s/libexecdir/gitexecdir contrib/subtree/Makefile: Doc-gen rules cleanup contrib/subtree/Makefile: clean rule cleanup contrib/subtree/Makefile | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/5] contrib/subtree/Makefile: scrap unused $(gitdir)
In 7ff8463dba0d74fc07a766bed457ae7afcc902b5, the references to gitdir were removed but the assignment itself wasn't. Hence, drop the gitdir assignment. Reviewed-by: Jeff King p...@peff.net Signed-off-by: James Denholm nod.h...@gmail.com --- contrib/subtree/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile index 4030a16..87797ed 100644 --- a/contrib/subtree/Makefile +++ b/contrib/subtree/Makefile @@ -4,7 +4,6 @@ prefix ?= /usr/local mandir ?= $(prefix)/share/man libexecdir ?= $(prefix)/libexec/git-core -gitdir ?= $(shell git --exec-path) man1dir ?= $(mandir)/man1 gitver ?= $(word 3,$(shell git --version)) -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
read-tree bug
Some more info: If I use in 5-th command “—prefix=--prefix=mb/trunk/src/libs“ - issue is reproduced If “—prefix=--prefix=mb/libs“ - all work fine With “—prefix=--prefix=mb/trunk/libs“ I haven’t tried, if it is desired to check this case, just let me know. On 5/6/14, 15:35, Klishevich, Yauheni yklishev...@scnsoft.com wrote: Hello! I have some troubles with git command ³read-tree². I have big project and I try to add shared library to subdirectory. So I made the following in my project (on master) git remote add g...@bitbucket.org:ijin1984/groundwork.git git fetch groundwork git checkout b gwbranch groundwork/master git checkout master git read-tree --prefix=mb/trunk/src/ru.uralsib.dbo.client.iphone/libs/ -u gwbranch git commit m ³add groundwork to libs² After that I make small change in one file inside libs (for example in mb/trunk/src/ru.uralsib.dbo.client.iphone/libs/groundwork/notes.txt² and commit with git commit a m ³test commit² Then I made: git checkout gwbranch git merge --squash -s subtree --no-commit master And after this instead of merging I find the whole main project in subdir ³groundwork/Groundwork/Base.lproj². If I do the 5-th command with ‹prefix option value equal to for example ³libs² tether than something like ³subdir/subsubdir/Š/libs² - all works fine. I think that it is bag, because I experimented quite a lot with deferrent values. I think that problem in directory name with dots, i.e. ru.uralsib.dbo.client.iphone². Could you please help me with this issue. If you need to add some more info about this case I will provide. Thanks in advance. Best regards, Eugene Klishevich iOS-developer skype: eugene.klishevich N�r��yb�X��ǧv�^�){.n�+ا���ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z��w���?��)ߢf
Re: [PATCH 7/9] bundle.c: convert leaf functions to struct object_id
On 05/03/2014 10:12 PM, brian m. carlson wrote: Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- bundle.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/bundle.c b/bundle.c index 1222952..798ba28 100644 --- a/bundle.c +++ b/bundle.c @@ -11,11 +11,11 @@ static const char bundle_signature[] = # v2 git bundle\n; -static void add_to_ref_list(const unsigned char *sha1, const char *name, +static void add_to_ref_list(const struct object_id *sha1, const char *name, struct ref_list *list) { ALLOC_GROW(list-list, list-nr + 1, list-alloc); - hashcpy(list-list[list-nr].sha1, sha1); + hashcpy(list-list[list-nr].sha1, sha1-oid); list-list[list-nr].name = xstrdup(name); list-nr++; } @@ -39,7 +39,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header, /* The bundle header ends with an empty line */ while (!strbuf_getwholeline_fd(buf, fd, '\n') buf.len buf.buf[0] != '\n') { - unsigned char sha1[20]; + struct object_id sha1; int is_prereq = 0; if (*buf.buf == '-') { @@ -53,9 +53,9 @@ static int parse_bundle_header(int fd, struct bundle_header *header, * Prerequisites have object name that is optionally * followed by SP and subject line. */ - if (get_sha1_hex(buf.buf, sha1) || - (buf.len 40 !isspace(buf.buf[40])) || - (!is_prereq buf.len = 40)) { + if (get_sha1_hex(buf.buf, sha1.oid) || + (buf.len GIT_OID_HEXSZ !isspace(buf.buf[GIT_OID_HEXSZ])) || + (!is_prereq buf.len = GIT_OID_HEXSZ)) { if (report_path) error(_(unrecognized header: %s%s (%d)), (is_prereq ? - : ), buf.buf, (int)buf.len); @@ -63,9 +63,9 @@ static int parse_bundle_header(int fd, struct bundle_header *header, break; } else { if (is_prereq) - add_to_ref_list(sha1, , header-prerequisites); + add_to_ref_list(sha1, , header-prerequisites); else - add_to_ref_list(sha1, buf.buf + 41, header-references); + add_to_ref_list(sha1, buf.buf + 41, header-references); I think that 41 here is GIT_OID_HEXSZ + 1. [...] Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9] cache-tree: convert struct cache_tree to use object_id
On 05/03/2014 10:12 PM, brian m. carlson wrote: Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- builtin/commit.c | 2 +- builtin/fsck.c | 4 ++-- cache-tree.c | 30 +++--- cache-tree.h | 3 ++- merge-recursive.c | 2 +- reachable.c| 2 +- sequencer.c| 2 +- test-dump-cache-tree.c | 4 ++-- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/builtin/commit.c b/builtin/commit.c index 9cfef6c..639f843 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1659,7 +1659,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) append_merge_tag_headers(parents, tail); } - if (commit_tree_extended(sb, active_cache_tree-sha1, parents, sha1, + if (commit_tree_extended(sb, active_cache_tree-sha1.oid, parents, sha1, author_ident.buf, sign_commit, extra)) { rollback_index_files(); die(_(failed to write commit object)); diff --git a/builtin/fsck.c b/builtin/fsck.c index fc150c8..6854c81 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -587,10 +587,10 @@ static int fsck_cache_tree(struct cache_tree *it) fprintf(stderr, Checking cache tree\n); if (0 = it-entry_count) { - struct object *obj = parse_object(it-sha1); + struct object *obj = parse_object(it-sha1.oid); if (!obj) { error(%s: invalid sha1 pointer in cache-tree, - sha1_to_hex(it-sha1)); + sha1_to_hex(it-sha1.oid)); return 1; } obj-used = 1; diff --git a/cache-tree.c b/cache-tree.c index 7fa524a..b7b2d06 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -219,7 +219,7 @@ int cache_tree_fully_valid(struct cache_tree *it) int i; if (!it) return 0; - if (it-entry_count 0 || !has_sha1_file(it-sha1)) + if (it-entry_count 0 || !has_sha1_file(it-sha1.oid)) return 0; for (i = 0; i it-subtree_nr; i++) { if (!cache_tree_fully_valid(it-down[i]-cache_tree)) @@ -244,7 +244,7 @@ static int update_one(struct cache_tree *it, *skip_count = 0; - if (0 = it-entry_count has_sha1_file(it-sha1)) + if (0 = it-entry_count has_sha1_file(it-sha1.oid)) return it-entry_count; /* @@ -311,7 +311,7 @@ static int update_one(struct cache_tree *it, struct cache_tree_sub *sub; const char *path, *slash; int pathlen, entlen; - const unsigned char *sha1; + const struct object_id *sha1; unsigned mode; path = ce-name; @@ -327,21 +327,21 @@ static int update_one(struct cache_tree *it, die(cache-tree.c: '%.*s' in '%s' not found, entlen, path + baselen, path); i += sub-count; - sha1 = sub-cache_tree-sha1; + sha1 = sub-cache_tree-sha1; mode = S_IFDIR; if (sub-cache_tree-entry_count 0) to_invalidate = 1; } else { - sha1 = ce-sha1; + sha1 = (struct object_id *)ce-sha1; This topic was discussed on the mailing list in the abstract. Here is a concrete example. This cast is undefined, because you can't make the assumption that cache_entry::sha1 has the same alignment and padding as (struct object_id). I think the transition will be more tractable if you rewrite the data structures *first*; in this case changing cache_entry::sha1 to be (struct object_id) *before* rewriting code that works with it. [...] Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9] cache-tree: convert struct cache_tree to use object_id
On 05/03/2014 10:12 PM, brian m. carlson wrote: [...] diff --git a/cache-tree.c b/cache-tree.c index 7fa524a..b7b2d06 100644 --- a/cache-tree.c +++ b/cache-tree.c In this file I also found a couple other 20 that could be converted to GIT_OID_RAWSZ: Around line 369: strbuf_add(buffer, sha1, 20); And around line 490 (three instances): if (size 20) goto free_return; hashcpy(it-sha1, (const unsigned char*)buf); buf += 20; size -= 20; I guess a search for \[24][0-9]\ will find most (but not all!) of the literal constants that are derived from GIT_OID_RAWSZ and GIT_OID_HEXSZ. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 9/9] diff: convert struct combine_diff_path to object_id
On 05/03/2014 10:12 PM, brian m. carlson wrote: Signed-off-by: brian m. carlson sand...@crustytoothpaste.net --- combine-diff.c | 54 +++--- diff-lib.c | 10 +- diff.h | 5 +++-- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/combine-diff.c b/combine-diff.c index 24ca7e2..f97eb3a 100644 --- a/combine-diff.c +++ b/combine-diff.c [...] This file also has two literal 40 constants in it that are probably GIT_OID_HEXSZ. FWIW, I glanced over all of the patches in this series (though without systematically looking for other literal constants that should be derived from GIT_OID_RAWSZ and GIT_OID_HEXSZ) and, aside from the problems that I already noted, they looked OK to me. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] inline constant return from error() function
Commit e208f9c introduced a macro to turn error() calls into: (error(), -1) to make the constant return value more visible to the calling code (and thus let the compiler make better decisions about the code). This works well for code like: return error(...); but the -1 is superfluous in code that just calls error() without caring about the return value. In older versions of gcc, that was fine, but gcc 4.9 complains with -Wunused-value. We can work around this by encapsulating the constant return value in a static inline function, as gcc specifically avoids complaining about unused function returns unless the function has been specifically marked with the warn_unused_result attribute. We also use the same trick for config_error_nonbool and opterror, which learned the same error technique in a469a10. Reported-by: Felipe Contreras felipe.contre...@gmail.com Signed-off-by: Jeff King p...@peff.net --- On Mon, May 05, 2014 at 05:29:38PM -0400, Jeff King wrote: I cannot think of any other way to make the compiler aware of the constant value, but perhaps somebody else is more clever than I am. This came to me in a dream, and seems to work. cache.h | 2 +- git-compat-util.h | 6 +- parse-options.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 107ac61..e2f12b0 100644 --- a/cache.h +++ b/cache.h @@ -1272,7 +1272,7 @@ extern int git_env_bool(const char *, int); extern int git_config_system(void); extern int config_error_nonbool(const char *); #if defined(__GNUC__) ! defined(__clang__) -#define config_error_nonbool(s) (config_error_nonbool(s), -1) +#define config_error_nonbool(s) (config_error_nonbool(s), const_error()) #endif extern const char *get_log_output_encoding(void); extern const char *get_commit_output_encoding(void); diff --git a/git-compat-util.h b/git-compat-util.h index f6d3a46..b4c437e 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -331,7 +331,11 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))) * using the function as usual. */ #if defined(__GNUC__) ! defined(__clang__) -#define error(...) (error(__VA_ARGS__), -1) +static inline int const_error(void) +{ + return -1; +} +#define error(...) (error(__VA_ARGS__), const_error()) #endif extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params)); diff --git a/parse-options.h b/parse-options.h index 3189676..2f9be96 100644 --- a/parse-options.h +++ b/parse-options.h @@ -177,7 +177,7 @@ extern NORETURN void usage_msg_opt(const char *msg, extern int optbug(const struct option *opt, const char *reason); extern int opterror(const struct option *opt, const char *reason, int flags); #if defined(__GNUC__) ! defined(__clang__) -#define opterror(o,r,f) (opterror((o),(r),(f)), -1) +#define opterror(o,r,f) (opterror((o),(r),(f)), const_error()) #endif /*- incremental advanced APIs -*/ -- 2.0.0.rc1.436.g03cb729 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] let clang use the constant-return error() macro
Commit e208f9c converted error() into a macro to make its constant return value more apparent to calling code. Commit 5ded807 prevents us using this macro with clang, since clang's -Wunused-value is smart enough to realize that the constant -1 is useless in some contexts. However, since the last commit puts the constant behind an inline function call, this is enough to prevent the -Wunused-value warning on both modern gcc and clang. So we can now re-enable the macro when compiling with clang. Tested with clang 3.3, 3.4, and 3.5. Signed-off-by: Jeff King p...@peff.net --- I still get warnings when compiling with clang -O3, due to -Warray-bounds. It looks like a bug, though. Clang complains that: strcmp(argv[1], git) oversteps array bounds when the strcmp is expanded into a mess of builtin magic. So I don't think we are doing anything wrong here. cache.h | 2 +- git-compat-util.h | 2 +- parse-options.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index e2f12b0..35a3e6b 100644 --- a/cache.h +++ b/cache.h @@ -1271,7 +1271,7 @@ extern int check_repository_format_version(const char *var, const char *value, v extern int git_env_bool(const char *, int); extern int git_config_system(void); extern int config_error_nonbool(const char *); -#if defined(__GNUC__) ! defined(__clang__) +#if defined(__GNUC__) #define config_error_nonbool(s) (config_error_nonbool(s), const_error()) #endif extern const char *get_log_output_encoding(void); diff --git a/git-compat-util.h b/git-compat-util.h index b4c437e..70dc028 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -330,7 +330,7 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))) * trying to help gcc, anyway, it's OK; other compilers will fall back to * using the function as usual. */ -#if defined(__GNUC__) ! defined(__clang__) +#if defined(__GNUC__) static inline int const_error(void) { return -1; diff --git a/parse-options.h b/parse-options.h index 2f9be96..7940bc7 100644 --- a/parse-options.h +++ b/parse-options.h @@ -176,7 +176,7 @@ extern NORETURN void usage_msg_opt(const char *msg, extern int optbug(const struct option *opt, const char *reason); extern int opterror(const struct option *opt, const char *reason, int flags); -#if defined(__GNUC__) ! defined(__clang__) +#if defined(__GNUC__) #define opterror(o,r,f) (opterror((o),(r),(f)), const_error()) #endif -- 2.0.0.rc1.436.g03cb729 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] add a reflog_exists and delete_reflog abstraction
On 05/06/2014 12:57 AM, Ronnie Sahlberg wrote: This is a single patch that adds two new functions to try to hide the reflog implementation details from the callers in checkout.c and reflog.c. It adds new functions to test if a reflog exists and to delete it, thus allowing checkout.c to perform this if-test-then-delete operation without having to know the internal implementation of reflogs (i.e. that they are files that live unde r.git/logs) It also changes checkout.c to use ref_exists when checking for whether a ref exists or not instead of checking if the loose ref file exists or not. Using ref_exists instead both hides the reflog implementation details from checkout.c as well as making the code more robust against future changes. It currently has a hard assumption that the loose ref file must exist at this stage or else it would end up deleting the reflog which is true today, as far as I can tell, but would break if git would change such that we could have a branch checked out without having a loose ref file for that branch. For single patches, people usually don't send a separate cover letter. Any comments that you want to make that are not suitable for the commit message can go between the --- line and the diffstat of the patch email. Regarding this change, I think before too long we will also need an API to turn reflogs on for a reference. We might want to add a flag to ref transaction entries that cause the reflog to be created if it doesn't already exist. Reflogs can currently be created for a reference via the config setting core.logAllRefUpdates or (for branches) by git branch --create-reflog (maybe there are others). Several tests in the test suite currently create reflog files by hand. Thus we might also need a way to create reflogs at the command line by the time we implement pluggable reference backends. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] refs.c: add new functions reflog_exists and delete_reflog
On 05/06/2014 12:57 AM, Ronnie Sahlberg wrote: Add two new functions, reflog_exists and delete_reflog to hide the internal Need comma after delete_reflog. reflog implementation (that they are files under .git/logs/...) from callers. Update checkout.c to use these functions in update_refs_for_switch instead of building pathnames and calling out to file access functions. Update reflog.c to use these too check if the reflog exists. Now there are still many places s/too/to/ in reflog.c where we are still leaking the reflog storage implementation but this at least reduces the number of such dependencies by one. Finally change two places in refs.c itself to use the new function to check if a ref exists or not isntead of build-path-and-stat(). Now, this is strictly not all s/isntead/instead/ that important since these are in parts of refs that are implementing the actual file storage backend but on the other hand it will not hurt either. As an aside, I expect long term that reflog handling will be married more tightly to reference handling and probably both will become pluggable via a single mechanism. In config.c we also change to use the existing function ref_exists instead of s/config.c/checkout.c/ checking if the loose ref file exist. The previous code made the assumption that the branch we switched from must exist as a loose ref and thus checking the file would be sufficent. I think that assumption is always true in the s/sufficent/sufficient/ current code but it is still somewhat fragile since if git would change so that the checkedout branch could exist as a packed ref without a corresponding s/checkedout/checked-out/ loose ref then this subtle 'does the lose ref not exist' check would suddenly fail. I don't understand. It can *already* be the case that the checked-out branch only exists as a packed reference: $ git checkout master $ git pack-refs --all $ find .git/refs -type f $ So we already have a bug: $ git config core.logallrefupdates true $ git commit -m Initial --allow-empty [master (root-commit) 3a03d51] Initial $ git branch foo $ git pack-refs --all $ find .git/{refs,logs} -type f .git/logs/HEAD .git/logs/refs/heads/foo .git/logs/refs/heads/master $ git checkout foo Switched to branch 'foo' $ find .git/{refs,logs} -type f .git/logs/HEAD .git/logs/refs/heads/foo $ history | tail -10 Note that the reflog for refs/heads/master is incorrectly deleted when we run git checkout foo. By the way, in case it wasn't clear to you I think the code in question is trying to avoid leaving a reflog file behind when leaving an orphan branch that hasn't actually been created yet. So I think your change to using ref_exists() will indeed fix the bug (but please test!) Given that this is a real bug, I suggest breaking this change out into a separate patch with a corresponding addition to the test suite. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/checkout.c | 8 ++-- builtin/reflog.c | 2 +- refs.c | 20 ++-- refs.h | 6 ++ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index ff44921..f1dc56e 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -651,12 +651,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts, } } if (old-path old-name) { - char log_file[PATH_MAX], ref_file[PATH_MAX]; - - git_snpath(log_file, sizeof(log_file), logs/%s, old-path); - git_snpath(ref_file, sizeof(ref_file), %s, old-path); - if (!file_exists(ref_file) file_exists(log_file)) - remove_path(log_file); + if (!ref_exists(old-path) reflog_exists(old-path)) + delete_reflog(old-path); } } remove_branch_state(); diff --git a/builtin/reflog.c b/builtin/reflog.c index c12a9784..0e7ea74 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -369,7 +369,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused, if (!lock) return error(cannot lock ref '%s', ref); log_file = git_pathdup(logs/%s, ref); - if (!file_exists(log_file)) + if (!ref_exists(ref)) Shouldn't this be reflog_exists()? goto finish; if (!cmd-dry_run) { newlog_path = git_pathdup(logs/%s.lock, ref); diff --git a/refs.c b/refs.c index e59bc18..7d12ac7 100644 --- a/refs.c +++ b/refs.c @@ -2013,7 +2013,6 @@ int dwim_log(const char *str, int len, unsigned char *sha1, char **log) *log = NULL; for (p = ref_rev_parse_rules; *p; p++) { - struct stat st; unsigned char hash[20]; char
Re: [PATCH] merge-recursive.c: Fix case-changing merge bug
David Turner dtur...@twopensource.com writes: On a case-insensitive filesystem, when merging, a file would be wrongly deleted from the working tree if an incoming commit had renamed it changing only its case. When merging a rename, the file with the old name would be deleted -- but since the filesystem considers the old name to be the same as the new name, the new file would in fact be deleted. We avoid this by not deleting files that have a case-clone in the index at stage 0. Signed-off-by: David Turner dtur...@twitter.com --- merge-recursive.c | 6 ++ t/t7063-merge-ignorecase.sh | 32 2 files changed, 38 insertions(+) create mode 100755 t/t7063-merge-ignorecase.sh diff --git a/merge-recursive.c b/merge-recursive.c index 4177092..cab16fa 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -589,6 +589,12 @@ static int remove_file(struct merge_options *o, int clean, return -1; } if (update_working_directory) { + if (ignore_case) { + struct cache_entry *ce; + ce = cache_file_exists(path, strlen(path), ignore_case); + if (ce ce_stage(ce) == 0) + return 0; + } if (remove_path(path)) return -1; } Thanks. I wonder what happens if you did the same merge using the resolve strategy, though. If you see a similar issue, and the true reason of the breakage turns out to be because three-way merge performed by unpack_trees() (with opts.update set to 1) considers that these paths that only differ in case in our tree, in the index and in the working tree are different paths (I am not saying that is the case, but that was one of my first hunches after seeing the initial report) then it may suggest that the above might not be the best change to fix the issue. diff --git a/t/t7063-merge-ignorecase.sh b/t/t7063-merge-ignorecase.sh new file mode 100755 index 000..6d4959f --- /dev/null +++ b/t/t7063-merge-ignorecase.sh Hmmm, did you really have to add a file dedicated for this single test? @@ -0,0 +1,32 @@ +#!/bin/sh + +test_description='git-merge with case-changing rename on case-insensitive file system' + +. ./test-lib.sh + +if ! test_have_prereq CASE_INSENSITIVE_FS +then + skip_all='skipping case insensitive tests - case sensitive file system' + test_done +fi + +test_expect_success 'merge with case-changing rename with ignorecase=true' ' + test $(git config core.ignorecase) = true + touch TestCase + git add TestCase + git commit -m add TestCase + git checkout -b with-camel + touch foo + git add foo + git commit -m intervening commit + git checkout master + git rm TestCase + touch testcase + git add testcase + git commit -m rename to testcase + git checkout with-camel + git merge master -m merge + test -e testcase +' + +test_done -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] pager: remove 'S' from $LESS by default
Matthieu Moy matthieu@grenoble-inp.fr writes: By default, Git used to set $LESS to -FRSX if $LESS was not set by the user. The FRX flags actually make sense for Git (F and X because Git sometimes pipes short output to less, and R because Git pipes colored output). The S flag (chop long lines), on the other hand, is not related to Git and is a matter of user preference. Git should not decide for the user to change LESS's default. Thanks! Sounds like a very good change. (Nit: instead of because Git sometimes pipes short output to less, it would be clearer to say something like when Git pipes short output to less it is nice to exit and let the user type their next command.) It's actually a bit more than this: X to avoid initializing the terminal and F for the exit behavior you describe. But since the change is actually not about F and X, I prefered keeping the text about them as short as possible, so I prefer my version actually. True. As some of you might know, the version I use for my regular work is slightly ahead of 'next' (you can see where it is by running git log --oneline --first-parent master..pu and find the first entry marked as Merge ... into jch). After having this patch for a few days in there and using it, I have to say that I like this change a lot while viewing the git log -p output. I still find the output from git blame disturbing, though. The first thing I do in git blame output is to scroll to the right in order to identify the the area I am interested in, and this first step is not negatively affected, because the right scrolled output automatically wraps long lines. But my second step is to scroll back to the left edge to find the commit object name and at that point, the new default output without S gets somewhat annoying, because most of the output lines from git blame are longer than my window width. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] merge-recursive.c: Fix case-changing merge bug
On Tue, 2014-05-06 at 10:07 -0700, Junio C Hamano wrote: David Turner dtur...@twopensource.com writes: On a case-insensitive filesystem, when merging, a file would be wrongly deleted from the working tree if an incoming commit had renamed it changing only its case. When merging a rename, the file with the old name would be deleted -- but since the filesystem considers the old name to be the same as the new name, the new file would in fact be deleted. We avoid this by not deleting files that have a case-clone in the index at stage 0. Signed-off-by: David Turner dtur...@twitter.com --- merge-recursive.c | 6 ++ t/t7063-merge-ignorecase.sh | 32 2 files changed, 38 insertions(+) create mode 100755 t/t7063-merge-ignorecase.sh diff --git a/merge-recursive.c b/merge-recursive.c index 4177092..cab16fa 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -589,6 +589,12 @@ static int remove_file(struct merge_options *o, int clean, return -1; } if (update_working_directory) { + if (ignore_case) { + struct cache_entry *ce; + ce = cache_file_exists(path, strlen(path), ignore_case); + if (ce ce_stage(ce) == 0) + return 0; + } if (remove_path(path)) return -1; } Thanks. I wonder what happens if you did the same merge using the resolve strategy, though. If you see a similar issue, and the true reason of the breakage turns out to be because three-way merge performed by unpack_trees() (with opts.update set to 1) considers that these paths that only differ in case in our tree, in the index and in the working tree are different paths (I am not saying that is the case, but that was one of my first hunches after seeing the initial report) then it may suggest that the above might not be the best change to fix the issue. I changed the test to -s resolve, and it changed from failing to passing. So while I still don't know whether this is the right change, it's at least not wrong for that reason. diff --git a/t/t7063-merge-ignorecase.sh b/t/t7063-merge-ignorecase.sh new file mode 100755 index 000..6d4959f --- /dev/null +++ b/t/t7063-merge-ignorecase.sh Hmmm, did you really have to add a file dedicated for this single test? Would you prefer that I add it to t6022-merge-rename.sh? Or I could add it to t7062-wtstatus-ignorecase.sh and rename that file to t7062-ignorecase.sh. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (Apr 2014, #09; Tue, 29)
John Keeping j...@keeping.me.uk writes: And it is now probably too late for that to make Git 2.0,... Anything with end-user visible changes in the core part that is not a fix to a regression introduced between v1.9.0..master is too late for the upcoming release. We are way past -rc1. So I think these are the two options: 1) Include git-remote-hg/bzr to the core and distribute them by default (as is the current intention) 2) Remove git-remote-hg/bzr entirely from the Git tree. And do the same for other tools: git-p4, git-svn, git-cvs*. Given the huge amount of people using Subversion, we might want to defer that one for later, but eventually do it. Isn't there a middle ground? The option 1.5 may be like this: - Eject tools in contrib/ that would benefit the users better if they were outside my tree. There are a few points to consider when judging benefit better if outside: * Their release cycle requirements are better met outside my tree (the remote-hg depends not just on Git but Hg internal issue we have discussed). * They are actively maintained. The overall Git maintainer would merely be being a bottleneck than being a helpful editor with respect to these tools if we keep them in my tree, and we expect that the tool maintainer would do a much better job without me. - Keep tools that are not actively maintained but still used by the users widely in my tree, but when their external dependencies become baggage to Git as a whole, demote them to contrib/ and stop installing them by default. - I would not mind having install.contrib-frotz target in the top-level Makefile for each of the remaining contrib/frotz hierarchies for those users and distro packagers who know their platform meets the dependency requirements. I'm not sure it needs to wait for a major Git release since most of the impact is on package maintainers and not end users. Removal of features is a big deal, I would think, though. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] pager: remove 'S' from $LESS by default
Junio C Hamano gits...@pobox.com writes: I still find the output from git blame disturbing, though. The first thing I do in git blame output is to scroll to the right in order to identify the the area I am interested in, and this first step is not negatively affected, because the right scrolled output automatically wraps long lines. But my second step is to scroll back to the left edge to find the commit object name and at that point, the new default output without S gets somewhat annoying, because most of the output lines from git blame are longer than my window width. git blame sucks in anything but fullscreen either way. It would help to display _only_ the source code and have the other info as mouse-over, but that's not something a pager can do. It is a pity that the content can be columnized much worse than the metadata: otherwise it would make much more sense to display the content _first_ in line. The metadata is useless without the content anyway. -- David Kastrup -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.
Nathan Collins nathan.coll...@gmail.com writes: Hmmm. Maybe a warning that the patch is expected to be in '-p1' format, and that setting 'diff.noprefix=true' makes some commands generate '-p0' patches? some? Do you have exceptions in mind? But I worry this would just confuse / distract the people that don't have 'diff.noprefix=true' set, Probably. But that would suggest that the place to improve the doc is for diff.noprefix configuration variable, no? Better I think would be for 'git apply' to be smarter, as you suggest below. As it is a plumbing command behind add -p, am, and friends, I would hate to see git apply pretend to be smarter than its users. When the user tells it to use -p0, it shouldn't guess, and when the user tells it to use -p1 by not giving any -p$n, it shouldn't guess. As long as we make it clear git apply without any explicit -p$n means the user is telling it to do -p1 in its documentation, I think it would be fine. I personally think setting diff.noprefix is not very sane (it also breaks patch -p1), and I suppose I should have been louder about that when it was introduced. I share the same feeling ;-) But the boat has sailed, so the best we could do is to warn in its doc (i.e. where diff.noprefix is described) about its pitfalls. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] refs.c: add new functions reflog_exists and delete_reflog
Thanks. On Tue, May 6, 2014 at 8:55 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 05/06/2014 12:57 AM, Ronnie Sahlberg wrote: Add two new functions, reflog_exists and delete_reflog to hide the internal Need comma after delete_reflog. Done. And the other typos too. reflog implementation (that they are files under .git/logs/...) from callers. Update checkout.c to use these functions in update_refs_for_switch instead of building pathnames and calling out to file access functions. Update reflog.c to use these too check if the reflog exists. Now there are still many places s/too/to/ in reflog.c where we are still leaking the reflog storage implementation but this at least reduces the number of such dependencies by one. Finally change two places in refs.c itself to use the new function to check if a ref exists or not isntead of build-path-and-stat(). Now, this is strictly not all s/isntead/instead/ that important since these are in parts of refs that are implementing the actual file storage backend but on the other hand it will not hurt either. As an aside, I expect long term that reflog handling will be married more tightly to reference handling and probably both will become pluggable via a single mechanism. In config.c we also change to use the existing function ref_exists instead of s/config.c/checkout.c/ checking if the loose ref file exist. The previous code made the assumption that the branch we switched from must exist as a loose ref and thus checking the file would be sufficent. I think that assumption is always true in the s/sufficent/sufficient/ current code but it is still somewhat fragile since if git would change so that the checkedout branch could exist as a packed ref without a corresponding s/checkedout/checked-out/ loose ref then this subtle 'does the lose ref not exist' check would suddenly fail. I don't understand. It can *already* be the case that the checked-out branch only exists as a packed reference: $ git checkout master $ git pack-refs --all $ find .git/refs -type f $ So we already have a bug: $ git config core.logallrefupdates true $ git commit -m Initial --allow-empty [master (root-commit) 3a03d51] Initial $ git branch foo $ git pack-refs --all $ find .git/{refs,logs} -type f .git/logs/HEAD .git/logs/refs/heads/foo .git/logs/refs/heads/master $ git checkout foo Switched to branch 'foo' $ find .git/{refs,logs} -type f .git/logs/HEAD .git/logs/refs/heads/foo $ history | tail -10 Note that the reflog for refs/heads/master is incorrectly deleted when we run git checkout foo. By the way, in case it wasn't clear to you I think the code in question is trying to avoid leaving a reflog file behind when leaving an orphan branch that hasn't actually been created yet. So I think your change to using ref_exists() will indeed fix the bug (but please test!) I tested with the sequence above and it does indeed fix the issue. I will put this change in a separate patch and create a test for it. Given that this is a real bug, I suggest breaking this change out into a separate patch with a corresponding addition to the test suite. Will do. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/checkout.c | 8 ++-- builtin/reflog.c | 2 +- refs.c | 20 ++-- refs.h | 6 ++ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index ff44921..f1dc56e 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -651,12 +651,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts, } } if (old-path old-name) { - char log_file[PATH_MAX], ref_file[PATH_MAX]; - - git_snpath(log_file, sizeof(log_file), logs/%s, old-path); - git_snpath(ref_file, sizeof(ref_file), %s, old-path); - if (!file_exists(ref_file) file_exists(log_file)) - remove_path(log_file); + if (!ref_exists(old-path) reflog_exists(old-path)) + delete_reflog(old-path); } } remove_branch_state(); diff --git a/builtin/reflog.c b/builtin/reflog.c index c12a9784..0e7ea74 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -369,7 +369,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused, if (!lock) return error(cannot lock ref '%s', ref); log_file = git_pathdup(logs/%s, ref); - if (!file_exists(log_file)) + if (!ref_exists(ref)) Shouldn't this be reflog_exists()? Yes, fixed. goto finish; if (!cmd-dry_run) { newlog_path = git_pathdup(logs/%s.lock, ref); diff --git a/refs.c
Re: [PATCH] test doc: test_write_lines does not split its arguments
On Mon, May 05, 2014 at 04:51:43PM -0700, Jonathan Nieder wrote: test_write_lines carefully quotes its arguments as $@, so test_write_lines a b c writes two lines as requested, not three. Signed-off-by: Jonathan Nieder jrnie...@gmail.com Acked-by: Michael S. Tsirkin m...@redhat.com --- Hi, Michael S. Tsirkin wrote: +++ b/t/README @@ -596,6 +596,28 @@ library for your script to use. + test_write_lines a b c d e f g foo + + Is a more compact equivalent of: + cat foo -EOF + a + b [...] +++ b/t/test-lib-functions.sh @@ -717,6 +717,11 @@ test_ln_s_add () { fi } +# This function writes out its parameters, one per line +test_write_lines () { + printf %s\n $@ +} How about this patch? Thanks, Jonathan t/README | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/t/README b/t/README index 2d6232f..8a9d499 100644 --- a/t/README +++ b/t/README @@ -596,15 +596,14 @@ library for your script to use. ... ' - - test_write_lines text + - test_write_lines lines - Split text to white-space separated words and write it out on standard - output, one word per line. + Write lines on standard output, one line per argument. Useful to prepare multi-line files in a compact form. Example: - test_write_lines a b c d e f g foo + test_write_lines a b c d e f g foo Is a more compact equivalent of: cat foo -EOF -- 1.9.1.423.g4596e3a -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 04/28] Allow guilt import-commit to run from a dir which contains spaces.
On Sun, Mar 23, 2014 at 10:13:53PM +0100, Per Cederqvist wrote: On Sun, Mar 23, 2014 at 9:07 PM, Jeff Sipek jef...@josefsipek.net wrote: On Sun, Mar 23, 2014 at 08:57:08PM +0100, Per Cederqvist wrote: On Sun, Mar 23, 2014 at 6:04 PM, Jeff Sipek jef...@josefsipek.net wrote: On Fri, Mar 21, 2014 at 08:31:42AM +0100, Per Cederqvist wrote: Signed-off-by: Per Cederqvist ced...@opera.com --- guilt-import-commit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guilt-import-commit b/guilt-import-commit index 20dcee2..9488ded 100755 --- a/guilt-import-commit +++ b/guilt-import-commit @@ -23,7 +23,7 @@ if ! must_commit_first; then fi disp About to begin conversion... 2 -disp Current head: `cat $GIT_DIR/refs/heads/\`git_branch\`` 2 +disp Current head: `cat \$GIT_DIR\/refs/heads/\`git_branch\`` 2 I wonder if it'd be better to use 'git rev-parse' here instead of looking at the refs directly. IOW, disp Current head: `git rev-parse \`git_branch\`` 2 That is probably a good idea. I only made the minimum change required to get the test suite to pass. I totally understand. Maybe even $() instead of the inner `` to clean it up some more. Yes, given that that construct is already used in several places it is apparently portable enough for guilt. (I guess nobody uses /bin/sh on Solaris to run guilt. It doesn't support the $(...) construct.) Hrm? I'm using OpenIndiana (OpenSolaris derivative) and my /bin/sh seems to be a symlink to ksh93. What version of Solaris are you seeing this behavior on? Solaris 10: Last login: Sun Mar 23 20:53:28 2014 from c80-217-121-12. Sun Microsystems Inc. SunOS 5.10 Generic January 2005 You have mail. 500 ceder@bacon uname -a SunOS bacon 5.10 Generic_147147-26 sun4u sparc SUNW,Sun-Fire-15000 501 ceder@bacon /bin/sh $ echo `id` uid=105(ceder) gid=20105(ceder) $ echo $(id) syntax error: `(' unexpected /bin/sh is a symlink to /sbin/sh. On Solaris 10, you are supposed to use /usr/xpg4/bin/sh if you want a competent standards-compliant shell. /bin/sh is provided as a very backward-compatible shell. Ok, I finally got back to this series... I'd say let's use the nested ``. Jeff. -- Hegh QaQ law' quvHa'ghach QaQ puS -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/3] Use ref transactions for fetch
Michael Haggerty mhag...@alum.mit.edu writes: It would be pretty annoying to spend a lot of time fetching a big pack, only to have the fetch fail because one reference out of many couldn't be updated. This would force the user to download the entire pack again,... Is that really true? Doesn't quickfetch optimization kick in for the second fetch? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] pager: remove 'S' from $LESS by default
David Kastrup d...@gnu.org writes: Junio C Hamano gits...@pobox.com writes: I still find the output from git blame disturbing, though. The first thing I do in git blame output is to scroll to the right in order to identify the the area I am interested in, and this first step is not negatively affected, because the right scrolled output automatically wraps long lines. But my second step is to scroll back to the left edge to find the commit object name and at that point, the new default output without S gets somewhat annoying, because most of the output lines from git blame are longer than my window width. git blame sucks in anything but fullscreen either way. It would help to display _only_ the source code and have the other info as mouse-over, but that's not something a pager can do. Exactly. I personally never use git blame outside git gui blame for this reason. It's possible for a user to set pager.blame to less -S to get back to the previous behavior only for blame. The idea of having a separate default value for pager.blame (or set $LESS differently for blame) crossed my mind, but I actually don't like it, as it would make it harder for a user to fine-tune his configuration manually (one would have to cancel all the corner-cases that Git would set by default). -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (Apr 2014, #09; Tue, 29)
Junio C Hamano wrote: John Keeping j...@keeping.me.uk writes: And it is now probably too late for that to make Git 2.0,... Anything with end-user visible changes in the core part that is not a fix to a regression introduced between v1.9.0..master is too late for the upcoming release. We are way past -rc1. The patch in question only affects users of hg v3.0 since it's surrounded by a 'check_version(3, 0)'. Therefore it cannot introduce regressions, there's no reason not to apply it. So I think these are the two options: 1) Include git-remote-hg/bzr to the core and distribute them by default (as is the current intention) 2) Remove git-remote-hg/bzr entirely from the Git tree. And do the same for other tools: git-p4, git-svn, git-cvs*. Given the huge amount of people using Subversion, we might want to defer that one for later, but eventually do it. Isn't there a middle ground? The option 1.5 may be like this: - Eject tools in contrib/ that would benefit the users better if they were outside my tree. There are a few points to consider when judging benefit better if outside: * Their release cycle requirements are better met outside my tree (the remote-hg depends not just on Git but Hg internal issue we have discussed). Shouldn't *I* be the one most qualified to know if the release cycle requirements are better met outside the git.git tree? * They are actively maintained. The overall Git maintainer would merely be being a bottleneck than being a helpful editor with respect to these tools if we keep them in my tree, and we expect that the tool maintainer would do a much better job without me. Perhaps. But only if the patches are reviewed throught the git mailing list. And what about the tools that are not actively maintainted? For example 'contrib/hg-to-git'. - Keep tools that are not actively maintained but still used by the users widely in my tree, but when their external dependencies become baggage to Git as a whole, demote them to contrib/ and stop installing them by default. That implies that git-remote-hg would become a baggage to Git as a whole. If you are arguing that git-remote-hg should be distributed by default, and only if the dependencies become a problem, demote to 'contrib/' that is fine. The same for git-p4 and other tools already out of contrib. -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 06/28] Fix and simplify the do_get_patch function.
On Sun, Mar 23, 2014 at 10:03:48PM +0100, Per Cederqvist wrote: On Sun, Mar 23, 2014 at 6:09 PM, Jeff Sipek jef...@josefsipek.net wrote: On Fri, Mar 21, 2014 at 08:31:44AM +0100, Per Cederqvist wrote: When extracting the patch, we only want the actual patches. We don't want the --- delimiter. Simplify the extraction by simply deleting everything before the first diff line. (Use sed instead of awk to simplify the code.) Without this patch, guilt fold and guilt push sometimes fails if guilt.diffstat is true. Hrm, I just did a test and guilt-push seems to work with a patch such as: aoeuaoeu this is --- not a patch! --- foo |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/foo b/foo index e69de29..203a557 100644 --- a/foo +++ b/foo @@ -0,0 +1 @@ +aoue What sort of thing breaks fold/push? ... diff --git a/guilt b/guilt index 8701481..c59cd0f 100755 --- a/guilt +++ b/guilt @@ -332,12 +332,7 @@ do_make_header() # usage: do_get_patch patchfile do_get_patch() { - awk ' -BEGIN{} -/^(diff |---$|--- )/ {patch = 1} -patch == 1 {print $0} -END{} -' $1 + sed -n '/^diff /,$p' $1 So, the thought behind this mess was to allow minimal patches to work. The 'diff' line is *not* required by patch(1)! I see. I can see that this is sometimes useful, even though I think it is more important that guilt actually works with the patches itself creates. Fair enough. I'm convinced that we should assume that all patches start with 'diff '. ... I had to solve a similar problem when I wrote my utility for diffing two diff files (https://git.lysator.liu.se/pdiffdiff). Based on the experience I got doing that, I propose this new do_get_patch function: ... The idea is to collect lines that *might* start the patch in patchheader. Once we detect the start of the patch (via a line that matches --- or any of the mode change lines) we print the patcheader and the current line. If we get a line that neither looks like a patchheader nor starts a patch, we discard the patcheader. This is the case of a commit message with a line that starts with diff . The function above solves the issue with lines that start with diff in the commit message. On the other hand, it introduces the same issue for lines that start with for instance old mode . Hrm. I'm open to revisiting the get-patch/get-header functions to address the ambiguity issues in the future. Actually, a smaller change that probably fixes the issue with diffstat is to replace /^(diff |---$|--- )/ {patch = 1} witih /^(diff |--- )/ {patch = 1} as the problem with the original implementation is that the ---\n line that starts the diffstat should not start the patch. (Thinking out loud...) I suppose there are three portions to a patch file... (1) the description (2) optional diffstat (3) the patch You just convinced me that the patch should start with '^diff '. Currently, the diffstat begins with '^---$'. Sadly, the description can contain what looks like the beginning of a diffstat or a patch. In the case of do_get_patch, we're only interested in the patch, so we can just look for '^diff ' (because garbage before the diff itself seems to be ignored by git). (If we wanted to allow patches without the 'diff ' line, we'd need '^(diff |--- )'.) I feel like I'm missing something. Jeff. -- I'm somewhere between geek and normal. - Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] add a reflog_exists and delete_reflog abstraction
Ronnie Sahlberg sahlb...@google.com writes: It currently has a hard assumption that the loose ref file must exist at this stage or else it would end up deleting the reflog which is true today, as far as I can tell, but would break if git would change such that we could have a branch checked out without having a loose ref file for that branch. H. Do you mean this sequence will break? : gitster x; git init lo Initialized empty Git repository in /var/tmp/x/lo/.git/ : gitster x; cd lo : gitster lo/master; git commit --allow-empty -m initial [master (root-commit) db2b430] initial : gitster lo/master; git branch next Now we have two branches, master and next, and we are on master. : gitster lo/master; git pack-refs --all : gitster lo/master; ls .git/refs/heads ./ ../ : gitster lo/master; cat .git/packed-refs # pack-refs with: peeled fully-peeled db2b43072749258d1e3c119c9570349d77c26b3a refs/heads/master db2b43072749258d1e3c119c9570349d77c26b3a refs/heads/next And loose refs are fully packed. : gitster lo/master; git checkout next Switched to branch 'next' : gitster lo/next; ls .git/refs/heads ./ ../ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git fast-import: how to prevent incremental commit with no changes
Timo Teras timo.te...@iki.fi writes: I'm trying to script a setup that would periodically import a tarball to git with fast-import. But things do not always change, so I'd like fast-import to be able to not do the commit in case there is no change. That is, I'm constructing the commit with deleteall + importing each object by mark after that. Now, in case nothing changed, fast-import will happily create an empty commit for me. Would it be possible to add some flag that would make commit fail in case nothing changed? Any suggestions how to do this? I am not sure if such a conditional logically belongs to what fast-import does. Would it be an option for your script to rewind the HEAD after the import is done and it finds that the tarball did not have anything interesting new? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] add a reflog_exists and delete_reflog abstraction
On Tue, May 6, 2014 at 12:15 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: It currently has a hard assumption that the loose ref file must exist at this stage or else it would end up deleting the reflog which is true today, as far as I can tell, but would break if git would change such that we could have a branch checked out without having a loose ref file for that branch. H. Do you mean this sequence will break? As Michael suggested, this is already broken :-( This sequence will delete the reflog from master : $ git init-db $ git config core.logallrefupdates true $ git commit -m Initial --allow-empty [master (root-commit) bb11abe] Initial $ git reflog master [8561dcb master@{0}: commit (initial): Initial] $ find .git/{refs,logs} -type f | grep master [.git/refs/heads/master] [.git/logs/refs/heads/master] $ git branch foo $ git pack-refs --all $ find .git/{refs,logs} -type f | grep master [.git/logs/refs/heads/master] $ git checkout foo $ find .git/{refs,logs} -type f | grep master ... reflog file is missing ... $ git reflog master ... nothing ... I am adding a test for this in the next set of patches : diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 236b13a..8cab06f 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -245,4 +245,12 @@ test_expect_success 'gc.reflogexpire=false' ' ' +test_expect_success 'checkout should not delete log for packed ref' ' + test $(git reflog master | wc -l) = 4 + git branch foo + git pack-refs --all + git checkout foo + test $(git reflog master | wc -l) = 4 +' + test_done : gitster x; git init lo Initialized empty Git repository in /var/tmp/x/lo/.git/ : gitster x; cd lo : gitster lo/master; git commit --allow-empty -m initial [master (root-commit) db2b430] initial : gitster lo/master; git branch next Now we have two branches, master and next, and we are on master. : gitster lo/master; git pack-refs --all : gitster lo/master; ls .git/refs/heads ./ ../ : gitster lo/master; cat .git/packed-refs # pack-refs with: peeled fully-peeled db2b43072749258d1e3c119c9570349d77c26b3a refs/heads/master db2b43072749258d1e3c119c9570349d77c26b3a refs/heads/next And loose refs are fully packed. : gitster lo/master; git checkout next Switched to branch 'next' : gitster lo/next; ls .git/refs/heads ./ ../ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (Apr 2014, #09; Tue, 29)
John Keeping j...@keeping.me.uk writes: On Mon, May 05, 2014 at 04:50:58PM -0700, Junio C Hamano wrote: ... At the same time, however, the interface the remote helpers use to talk to Git has not been as stable as you seem to think, I am afraid. For example, a recent remote-hg/bzr series needed some enhancements to fast-import to achieve the feature parity with native transports by adding a missing feature or two on the Git side. This doesn't qualify as an unstable interface for me. That is true, but that does not change the equation very much, no? To a remote-helper maintainer, bundled is easier to maintain than unbundled, because both sides are changing, and regardless of the nature of the change, s/he would know how the Git side looks like if bundled. Having said that, I agree with the conclusion of your message: There is a different level of urgency between you cannot use this new feature until you update Git and if you update Mercurial then the remote helper will stop working, and that's why I think the remote helpers may benefit from a separate release schedule. and I am inclined to be persuaded that the users of remote-hg/bzr may better off if they are unbundled from my tree. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.
On Tue, May 6, 2014 at 11:10 AM, Junio C Hamano gits...@pobox.com wrote: Nathan Collins nathan.coll...@gmail.com writes: Hmmm. Maybe a warning that the patch is expected to be in '-p1' format, and that setting 'diff.noprefix=true' makes some commands generate '-p0' patches? some? Do you have exceptions in mind? As Jonathan pointed out in his first reply, 'git diff-tree' ignores the 'diff.noprefix=true' setting. Compare git -c diff.noprefix=true diff HEAD~ with git -c diff.noprefix=true diff-tree -p HEAD (E.g. diff (git -c diff.noprefix=true diff HEAD~) (git -c diff.noprefix=true diff-tree -p HEAD) ) But I worry this would just confuse / distract the people that don't have 'diff.noprefix=true' set, Probably. But that would suggest that the place to improve the doc is for diff.noprefix configuration variable, no? I don't think that would actually help much in practice. The problem is that a person (like me) that set 'diff.noprefix=true' in their ~/.gitconfig months or years ago is unlikely to do 'man git-config' when 'git apply' fails. Having the warning in 'man git-apply' is better than (only) in 'man git-config', if making 'git apply' smarter is not an option. Better I think would be for 'git apply' to be smarter, as you suggest below. As it is a plumbing command behind add -p, am, and friends, I would hate to see git apply pretend to be smarter than its users. When the user tells it to use -p0, it shouldn't guess, and when the user tells it to use -p1 by not giving any -p$n, it shouldn't guess. Is there a non-plumbing command for applying patches not in mailboxes? I don't see how to replace '| git apply --reverse' with '| git am ???' here. As long as we make it clear git apply without any explicit -p$n means the user is telling it to do -p1 in its documentation, I think it would be fine. OK, then how about a smarter error message? Right now I get git -c diff.noprefix=true diff HEAD~ | git -c diff.noprefix=true apply --reverse error: Data/Function/Decorator/Memoizer/Unsafe.hs: No such file or directory vs git -c diff.noprefix=true diff HEAD~ | patch --reverse can't find file to patch at input line 5 Perhaps you should have used the -p or --strip option? [...] But 'git apply' could be much more helpful than 'patch' even, since the presence or absence of the 'a/' and 'b/' prefixes in the patch, and the 'diff.noprefix' setting, give Git enough info to be very helpful to the user. Cheers, -nathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 07/28] Added test cases for guilt fold.
On Fri, Mar 21, 2014 at 08:31:45AM +0100, Per Cederqvist wrote: Test that we can combine any combination of patches with empty and non-empty messages, both with and without guilt.diffstat. (All patches are empty.) I feel like we should have *some* content there - most of the time, I care more about the diffs getting folded than the commit message :) Signed-off-by: Per Cederqvist ced...@opera.com --- regression/t-035.out | 659 +++ regression/t-035.sh | 88 +++ 2 files changed, 747 insertions(+) create mode 100644 regression/t-035.out create mode 100755 regression/t-035.sh diff --git a/regression/t-035.out b/regression/t-035.out new file mode 100644 index 000..04af146 --- /dev/null +++ b/regression/t-035.out @@ -0,0 +1,659 @@ +% setup_repo +% git config guilt.diffstat true +%% empty + empty (diffstat=true) +% guilt new empty-1 +% guilt pop +All patches popped. +% guilt push +Applying patch..empty-1 +Patch applied. +% guilt new empty-2 +% guilt pop +Now at empty-1. +% guilt push +Applying patch..empty-2 +Patch applied. +% guilt pop +Now at empty-1. +% guilt fold empty-2 +% guilt pop +All patches popped. +% guilt push +Applying patch..empty-1 +Patch applied. +% list_files +d .git/patches +d .git/patches/master +d .git/refs/patches +d .git/refs/patches/master +f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode +f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove +f 4ea806e306f0228a8ef41f186035e7b04097f1f2 .git/patches/master/status +f 7d261b8caad0f161c21daf5de65eeb521ff8c067 .git/patches/master/empty-1 +f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add +f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify +f d28d87b88c1e24d637e390dc3603cfa7c1715711 .git/patches/master/series +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/empty-1~ +f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/empty-2~ +r bde3d337af70f36836ad606c800d194006f883b3 .git/refs/patches/master/empty-1 +% git log -p Strictly speaking, git log isn't necessary since list_files prints the hashes of each of the files as well as the refs for all the applied patches. If anything mismatches, the hashes will catch it. I'm ok with keeping the git log here as long as people can't mess up the formatting with git config/etc. ... diff --git a/regression/t-035.sh b/regression/t-035.sh new file mode 100755 index 000..aed3ef2 --- /dev/null +++ b/regression/t-035.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# Test the fold code +# + +source $REG_DIR/scaffold + +cmd setup_repo + +function fixup_time_info +{ + cmd guilt pop + touch -a -m -t $TOUCH_DATE .git/patches/master/$1 + cmd guilt push +} + +function test_fold +{ +using_diffstat=$1 + +cmd git config guilt.diffstat $using_diffstat + +# Empty message + empty message = empty message. +echo %% empty + empty (diffstat=$using_diffstat) +cmd guilt new empty-1 +fixup_time_info empty-1 +cmd guilt new empty-2 +fixup_time_info empty-2 +cmd guilt pop +cmd guilt fold empty-2 +fixup_time_info empty-1 +cmd list_files +cmd git log -p +cmd guilt pop +cmd guilt delete -f empty-1 +cmd list_files + +# Empty message + non-empty message +echo %% empty + non-empty (diffstat=$using_diffstat) +cmd guilt new empty +fixup_time_info empty +cmd echo test a I see these redirected echos... what are they for? +cmd guilt new -f -s -m A commit message. non-empty +fixup_time_info non-empty +cmd guilt pop +cmd guilt fold non-empty +fixup_time_info empty +cmd list_files +cmd git log -p +cmd guilt pop +cmd guilt delete -f empty +cmd list_files Maybe make two helper functions.. one to make a patch with an empty message and one to make a patch with a non-empty message. Then each of these blocks would look a bit cleaner. echo %% empty + non-empty (diffstat=$using_diffstat) empty_patch empty nonempty_patch non-empty cmd guilt pop non-empty cmd guilt fold non-empty fixup_time_info empty cmd list_files cleanup empty cmd list_files cleanup() { guilt pop $1 guilt delete -f $1 } Eh, it's not as clean as I thought it would be, but I think it's still a bit better. Ok, how about: for using_diffstat in true false ; do for patcha in empty nonempty ; do for patchb in empty nonempty ; do echo %% $patcha + $patchb (diffstat=$using_diffstat) ${patcha}_patch $patcha ${patchb}_patch $patchb cmd guilt pop $patchb cmd guilt fold $patchb fixup_time_info $patcha cmd
Re: What's cooking in git.git (Apr 2014, #09; Tue, 29)
Junio C Hamano wrote: Having said that, I agree with the conclusion of your message: There is a different level of urgency between you cannot use this new feature until you update Git and if you update Mercurial then the remote helper will stop working, and that's why I think the remote helpers may benefit from a separate release schedule. The conclusion is correct, the premises are not. -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] merge-recursive.c: Fix case-changing merge bug
David Turner dtur...@twopensource.com writes: Would you prefer that I add it to t6022-merge-rename.sh? Or I could add it to t7062-wtstatus-ignorecase.sh and rename that file to t7062-ignorecase.sh. If I had only these two choices, t6022 would be it, as 6xxx series is where we have other tests for merge-recursive. I actually do not have a problem with adding a new file in t6xxx series as you did in this patch, if a longer term direction is to add more cases to it to make sure various paths that are only different in their cases (not just TC, TC, tc combination where one side renames, but things like tc, TC TC combination where both sides rename, etc.) are handled correctly during a merge. Thanks. By the way, I see touch used to create a new file in the test, like this: + touch foo + git add foo Please don't. Instead, do it perhaps like this: foo git add foo The primary purpose to use touch is to update a file's timestamp, and using it to create a file is misleading to readers. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 10/28] Run test_failed if the exit status of a test script is bad.
On Fri, Mar 21, 2014 at 08:31:48AM +0100, Per Cederqvist wrote: There were two problems with the old code: - Since set -e is in effect (that is set in scaffold) the run-test script exited immediately if a t-*.sh script failed. This is not nice, as we want the error report that test_failed prints. - The code ran cd - between running the t-*.sh script and checking the exit status, so the exit status was lost. (Actually, the exit status was saved in $ERR, but nothing ever looked at $ERR.) Oops :) Signed-off-by: Per Cederqvist ced...@opera.com --- regression/run-tests | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/regression/run-tests b/regression/run-tests index a10e796..d39f9ef 100755 --- a/regression/run-tests +++ b/regression/run-tests @@ -55,11 +55,16 @@ function run_test # run the test cd $REPODIR /dev/null - $REG_DIR/t-$1.sh 21 $LOGFILE - ERR=$? + if $REG_DIR/t-$1.sh 21 $LOGFILE + then + ERR=false + else + ERR=true I'm going to comment on this here... Coding style. Guilt is a bit of a hodge-podge of style as my personal style for shell changed over the years and various contributors threw in some more. I need to get better at spotting style mismatch during review. With that said, I have two comments about the above: (1) I'd put the 'then' on the same line as 'if' but I don't feel strongly enough about this to reject this patch. (2) Tabs for indentation. I do feel strongly about this one :) Jeff. + fi + cd - /dev/null - [ $? -ne 0 ] test_failed + $ERR test_failed diff -u t-$1.out $LOGFILE || test_failed echo done. -- 1.8.3.1 -- I'm somewhere between geek and normal. - Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 11/28] test suite: remove pointless redirection.
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net On Fri, Mar 21, 2014 at 08:31:49AM +0100, Per Cederqvist wrote: The shouldfail function already redirects stderr to stdout, so there is no need to do the same in t-028.sh and t-021.sh. Signed-off-by: Per Cederqvist ced...@opera.com --- regression/t-021.sh | 2 +- regression/t-025.sh | 2 +- regression/t-028.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/regression/t-021.sh b/regression/t-021.sh index 6337d7b..614e870 100755 --- a/regression/t-021.sh +++ b/regression/t-021.sh @@ -61,7 +61,7 @@ for n in `_seq -2 $npatches`; do if [ $n -gt 0 ]; then cmd guilt pop -n $n else - shouldfail guilt pop -n $n 21 + shouldfail guilt pop -n $n fi cmd list_files diff --git a/regression/t-025.sh b/regression/t-025.sh index 3824608..985fed4 100755 --- a/regression/t-025.sh +++ b/regression/t-025.sh @@ -44,7 +44,7 @@ shouldfail guilt new white space cmd list_files for pname in prepend mode /abc ./blah ../blah abc/./blah abc/../blah abc/. abc/.. abc/ ; do - shouldfail guilt new $pname 21 + shouldfail guilt new $pname cmd list_files done diff --git a/regression/t-028.sh b/regression/t-028.sh index 8480100..88e9adb 100755 --- a/regression/t-028.sh +++ b/regression/t-028.sh @@ -29,6 +29,6 @@ guilt series | while read n; do cmd guilt header $n done -shouldfail guilt header non-existant 21 +shouldfail guilt header non-existant # FIXME: how do we check that -e works? -- 1.8.3.1 -- Failure is not an option, It comes bundled with your Microsoft product. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 17/28] guilt graph no longer loops when no patches are applied.
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net On Fri, Mar 21, 2014 at 08:31:55AM +0100, Per Cederqvist wrote: Give an error message if no patches are applied. Added a test case that never terminates unless this fix is applied. Signed-off-by: Per Cederqvist ced...@opera.com --- guilt-graph | 10 -- regression/t-033.out | 3 +++ regression/t-033.sh | 11 +++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 regression/t-033.out create mode 100755 regression/t-033.sh diff --git a/guilt-graph b/guilt-graph index b3469dc..00301d5 100755 --- a/guilt-graph +++ b/guilt-graph @@ -17,8 +17,14 @@ fi patchname=$1 -bottom=`git rev-parse refs/patches/$branch/$(head_n 1 $applied)` -base=`git rev-parse $bottom^` +bottompatch=$(head_n 1 $applied) +if [ -z $bottompatch ] +then + echo No patch applied. 2 + exit 1 +fi + +base=`git rev-parse refs/patches/${branch}/${bottompatch}^` if [ -z $patchname ]; then top=`git rev-parse HEAD` diff --git a/regression/t-033.out b/regression/t-033.out new file mode 100644 index 000..76613f9 --- /dev/null +++ b/regression/t-033.out @@ -0,0 +1,3 @@ +% setup_repo +% guilt graph +No patch applied. diff --git a/regression/t-033.sh b/regression/t-033.sh new file mode 100755 index 000..ae40577 --- /dev/null +++ b/regression/t-033.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Test the graph code +# + +source $REG_DIR/scaffold + +cmd setup_repo + +shouldfail guilt graph + -- 1.8.3.1 -- You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists. - Abbie Hoffman -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 18/28] guilt-graph: Handle commas in branch names.
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net On Fri, Mar 21, 2014 at 08:31:56AM +0100, Per Cederqvist wrote: This fix relies on the fact that git branch names can not contain :. Signed-off-by: Per Cederqvist ced...@opera.com --- guilt-graph | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guilt-graph b/guilt-graph index 00301d5..575f03b 100755 --- a/guilt-graph +++ b/guilt-graph @@ -52,7 +52,7 @@ safebranch=`echo $branch|sed 's%/%/%g'` while [ $current != $base ]; do pname=`git show-ref | sed -n -e /^$current refs\/patches\/$safebranch/ { - s,^$current refs/patches/$branch/,, + s:^$current refs/patches/$branch/:: p q }` -- 1.8.3.1 -- Computer Science is no more about computers than astronomy is about telescopes. - Edsger Dijkstra -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 19/28] Check that guilt graph works when working on a branch with a comma.
On Fri, Mar 21, 2014 at 08:31:57AM +0100, Per Cederqvist wrote: git branch names can contain commas. Check that guilt graph works even in that case. Signed-off-by: Per Cederqvist ced...@opera.com --- regression/t-033.out | 62 regression/t-033.sh | 37 +++ 2 files changed, 99 insertions(+) diff --git a/regression/t-033.out b/regression/t-033.out index 76613f9..e638d7b 100644 --- a/regression/t-033.out +++ b/regression/t-033.out @@ -1,3 +1,65 @@ % setup_repo % guilt graph No patch applied. +% git checkout -b a,graph master +Switched to a new branch 'a,graph' +% guilt init +% guilt new a.patch +% guilt pop +All patches popped. +% guilt push +Applying patch..a.patch +Patch applied. +% guilt graph +digraph G { +# checking rev 95275d7c05c6a6176d3941374115b91272877f6c + 95275d7c05c6a6176d3941374115b91272877f6c [label=a.patch] +} +% git add file.txt +% guilt refresh +Patch a.patch refreshed +% guilt pop +All patches popped. +% guilt push +Applying patch..a.patch +Patch applied. +% guilt graph +digraph G { +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch] +} +% guilt new b.patch +% git add file2.txt +% guilt refresh +Patch b.patch refreshed +% guilt pop +Now at a.patch. +% guilt push +Applying patch..b.patch +Patch applied. +% guilt graph +digraph G { +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch] +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch] +} +% guilt new c.patch +% git add file.txt +% guilt refresh +Patch c.patch refreshed +% guilt pop +Now at b.patch. +% guilt push +Applying patch..c.patch +Patch applied. +% guilt graph +digraph G { +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5 + 891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch] +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch] +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch] + 891bc14b5603474c9743fd04f3da888644413dc5 - ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ? +} diff --git a/regression/t-033.sh b/regression/t-033.sh index ae40577..57dce78 100755 --- a/regression/t-033.sh +++ b/regression/t-033.sh @@ -3,9 +3,46 @@ # Test the graph code # +function fixup_time_info +{ + cmd guilt pop + touch -a -m -t $TOUCH_DATE .git/patches/a,graph/$1 + cmd guilt push +} + source $REG_DIR/scaffold cmd setup_repo A comment here to justify this seemingly useless guilt-graph call? Maybe adding one of the '%%' lines between each section. Otherwise, this looks good. shouldfail guilt graph +cmd git checkout -b a,graph master + +cmd guilt init + +cmd guilt new a.patch + +fixup_time_info a.patch +cmd guilt graph + +cmd echo a file.txt +cmd git add file.txt +cmd guilt refresh +fixup_time_info a.patch +cmd guilt graph + +# An unrelated file. No deps. +cmd guilt new b.patch +cmd echo b file2.txt +cmd git add file2.txt +cmd guilt refresh +fixup_time_info b.patch +cmd guilt graph + +# An change to an old file. Should add a dependency. +cmd guilt new c.patch +cmd echo c file.txt +cmd git add file.txt +cmd guilt refresh +fixup_time_info c.patch +cmd guilt graph -- 1.8.3.1 -- It used to be said [...] that AIX looks like one space alien discovered Unix, and described it to another different space alien who then implemented AIX. But their universal translators were broken and they'd had to gesture a lot. - Paul Tomblin -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 20/28] guilt graph: Handle patch names containing quotes.
On Fri, Mar 21, 2014 at 03:57:37AM -0400, Eric Sunshine wrote: On Fri, Mar 21, 2014 at 3:31 AM, Per Cederqvist ced...@opera.com wrote: Quote quotes with a backslash in the guitl graph output. Otherwise, s/guitl/guilt/ Yep. the dot file could contain syntax errors. Added a test case. --- guilt-graph | 2 ++ regression/t-033.out | 22 ++ regression/t-033.sh | 9 + 3 files changed, 33 insertions(+) diff --git a/guilt-graph b/guilt-graph index 575f03b..24ab83b 100755 --- a/guilt-graph +++ b/guilt-graph @@ -58,6 +58,8 @@ while [ $current != $base ]; do }` [ -z $pname ] pname=? + pname=`printf \%s\ $pname|sed 's/\/\/g'` Some of this filtering is getting a bit unwieldy. I'd add spaces around the |. Do we want to be paranoid and add quotes around $pname? If not, then it looks good. + disp # checking rev $current disp \$current\ [label=\$pname\] diff --git a/regression/t-033.out b/regression/t-033.out index e638d7b..1c28ea9 100644 --- a/regression/t-033.out +++ b/regression/t-033.out @@ -63,3 +63,25 @@ digraph G { ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch] 891bc14b5603474c9743fd04f3da888644413dc5 - ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ? } +% guilt new a-betterquicker'-patch.patch +% git add file.txt +% guilt refresh +Patch a-betterquicker'-patch.patch refreshed +% guilt pop +Now at c.patch. +% guilt push +Applying patch..a-betterquicker'-patch.patch +Patch applied. +% guilt graph +digraph G { +# checking rev bc7df666a646739eaf559af23cab72f2bfd01f0e + bc7df666a646739eaf559af23cab72f2bfd01f0e [label=a-\betterquicker'-patch.patch] +# checking rev 891bc14b5603474c9743fd04f3da888644413dc5 + 891bc14b5603474c9743fd04f3da888644413dc5 [label=c.patch] + bc7df666a646739eaf559af23cab72f2bfd01f0e - 891bc14b5603474c9743fd04f3da888644413dc5; // ? +# checking rev c7014443c33d2b0237293687ceb9cbd38313df65 + c7014443c33d2b0237293687ceb9cbd38313df65 [label=b.patch] +# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d + ff2775f8d1dc753f635830adcc3a067e0b681e2d [label=a.patch] + 891bc14b5603474c9743fd04f3da888644413dc5 - ff2775f8d1dc753f635830adcc3a067e0b681e2d; // ? +} diff --git a/regression/t-033.sh b/regression/t-033.sh index 57dce78..968292c 100755 --- a/regression/t-033.sh +++ b/regression/t-033.sh @@ -46,3 +46,12 @@ cmd git add file.txt cmd guilt refresh fixup_time_info c.patch cmd guilt graph + +# A patch name that contains funky characters, including unbalanced +# quotes. +cmd guilt new a-\betterquicker'-patch.patch +cmd echo d file.txt +cmd git add file.txt +cmd guilt refresh +fixup_time_info a-\betterquicker'-patch.patch +cmd guilt graph -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can’t get them together again, there must be a reason. By all means, do not use a hammer. — IBM Manual, 1925 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Summary of the problems with git pull
Felipe Contreras wrote in message 5366db742d494_18f9e4b308aa@nysa.notmuch: == git update == Another proposed solution is to have a new command: `git update`. This command would be similar to `git pull --ff-only` by default, but it could be configured to do merges instead, and when doing so in reverse. Thanks for the nice summary. As a user, I am very much in favor of adding a `git update` command. In fact I already have a ruby script that does such a thing (fast-forward all my local branches that have an upstream configured), so it would be nice to have it directly in git core. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 21/28] The log.decorate setting should not influence import-commit.
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net On Fri, Mar 21, 2014 at 08:31:59AM +0100, Per Cederqvist wrote: Use --no-decorate in the call to git log that tries to read the commit message to produce patch names. Otherwise, if the user has set log.decorate to short or full, the patch name will be less useful. Modify the t-034.sh test case to demonstrate that this is needed. Signed-off-by: Per Cederqvist ced...@opera.com --- guilt-import-commit | 2 +- regression/t-034.out | 2 ++ regression/t-034.sh | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/guilt-import-commit b/guilt-import-commit index 6eb2f4e..703f034 100755 --- a/guilt-import-commit +++ b/guilt-import-commit @@ -26,7 +26,7 @@ disp About to begin conversion... 2 disp Current head: `cat \$GIT_DIR\/refs/heads/\`git_branch\`` 2 for rev in `git rev-list $rhash`; do - s=`git log --pretty=oneline -1 $rev | cut -c 42-` + s=`git log --no-decorate --pretty=oneline -1 $rev | cut -c 42-` # Try to convert the first line of the commit message to a # valid patch name. diff --git a/regression/t-034.out b/regression/t-034.out index bda4399..5d81bd4 100644 --- a/regression/t-034.out +++ b/regression/t-034.out @@ -232,6 +232,7 @@ Date: Mon Jan 1 00:00:00 2007 + Signed-off-by: Commiter Name commiter@email % guilt init +% git config log.decorate short % guilt import-commit base..HEAD About to begin conversion... Current head: 2a8b1889aa5066193bac978e6bf5073ffcfa6541 @@ -259,6 +260,7 @@ Converting 45e81b51 as the_sequence_.lock-_is_forbidden Converting eebb76e9 as the_sequence_-._is_forbidden Done. Current head: d4850419ccc1146c7169f500725ce504b9774ed0 +% git config log.decorate no % guilt push -a Applying patch..the_sequence_-._is_forbidden.patch Patch applied. diff --git a/regression/t-034.sh b/regression/t-034.sh index 1055ddb..8179bc7 100755 --- a/regression/t-034.sh +++ b/regression/t-034.sh @@ -57,7 +57,9 @@ cmd git log # Import all the commits to guilt. cmd guilt init +cmd git config log.decorate short cmd guilt import-commit base..HEAD +cmd git config log.decorate no for patch in .git/patches/master/*.patch do -- 1.8.3.1 -- Evolution, n.: A hypothetical process whereby infinitely improbable events occur with alarming frequency, order arises from chaos, and no one is given credit. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 22/28] The log.decorate setting should not influence patchbomb.
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net On Fri, Mar 21, 2014 at 08:32:00AM +0100, Per Cederqvist wrote: Signed-off-by: Per Cederqvist ced...@opera.com --- guilt-patchbomb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guilt-patchbomb b/guilt-patchbomb index 1231418..164b10c 100755 --- a/guilt-patchbomb +++ b/guilt-patchbomb @@ -47,7 +47,7 @@ if [ $? -ne 0 ]; then fi # display the list of commits to be sent as patches -git log --pretty=oneline $r | cut -c 1-8,41- | $pager +git log --no-decorate --pretty=oneline $r | cut -c 1-8,41- | $pager _disp Are these what you want to send? [Y/n] read n -- 1.8.3.1 -- Ready; T=0.01/0.01 16:41:35 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GUILT 23/28] The log.decorate setting should not influence guilt rebase.
Signed-off-by: Josef 'Jeff' Sipek jef...@josefsipek.net On Fri, Mar 21, 2014 at 08:32:01AM +0100, Per Cederqvist wrote: Signed-off-by: Per Cederqvist ced...@opera.com --- guilt-rebase | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guilt-rebase b/guilt-rebase index fd28e48..a1714a0 100755 --- a/guilt-rebase +++ b/guilt-rebase @@ -66,7 +66,7 @@ pop_all_patches git merge --no-commit $upstream /dev/null 2 /dev/null disp -log=`git log -1 --pretty=oneline` +log=`git log -1 --no-decorate --pretty=oneline` disp HEAD is now at `echo $log | cut -c 1-7`... `echo $log | cut -c 41-` # -- 1.8.3.1 -- Don't drink and derive. Alcohol and algebra don't mix. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/3] Use ref transactions for fetch
On 05/06/2014 08:40 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: It would be pretty annoying to spend a lot of time fetching a big pack, only to have the fetch fail because one reference out of many couldn't be updated. This would force the user to download the entire pack again,... Is that really true? Doesn't quickfetch optimization kick in for the second fetch? Yes, I guess it would. I wasn't aware of that optimization. Thanks for the pointer. I withdraw my objection to using atomic reference updates for fetch. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] test-lib: '--run' to run only specific tests
Ilya Bobyr ilya.bo...@gmail.com writes: Allow better control of the set of tests that will be executed for a single test suite. Mostly useful while debugging or developing as it allows to focus on a specific test. Signed-off-by: Ilya Bobyr ilya.bo...@gmail.com --- A number of minor changes according to the review comments. I think the interaction between multiple selectors, especially when some of them are negated, are much better explained in this version, compared to the previous round in the README. But I still think that the negation a feature that is unnecessary and having it makes it harder to understand for users, especially after reading this part: +If --run starts with an unprefixed number or range the initial +set of tests to run is empty. If the first item starts with '!' +all the tests are added to the initial set. After initial set is +determined every test number or range is added or excluded from +the set one by one, from left to right. ... +As noted above, the test set is built going though items left to +right, so this: + +$ sh ./t9200-git-cvsexport-commit.sh --run='1-4 !3' + +will run tests 1, 2, and 4. Items that comes later have higher +precendence. It means that this: + +$ sh ./t9200-git-cvsexport-commit.sh --run='!3 1-4' + +would just run tests from 1 to 4, including 3. The initial !3 means the same thing as 1-2,4-, and then 1-4 will do what to that set? The answer is It is added... wouldn't the reader expect then that the result should be 1-, not 1-4? I myself wondered what would happen to the fifth test from your description. Has the text told the reader that t9200 test has only four tests? The need to explain better with longer description will reduce the likelyhood that the feature is understood and correctly used. When you can write 1-2,4-, why accept 1-4 !3 and force yourself to explain to people why that is different from !3 1-4? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] test-lib: '--run' to run only specific tests
Junio C Hamano gits...@pobox.com writes: The need to explain better with longer description will reduce the likelyhood that the feature is understood and correctly used. When you can write 1-2,4-, why accept 1-4 !3 and force yourself to explain to people why that is different from !3 1-4? By the way, having said all that, I would understand if the result is made not depend on the order of selectors given to the option. That is: - Find all the positive ones and form the positive set; if there is no positive ones, then make the positive set include everything. - Find all the negative ones and form a negative set. The negative set can be an empty set if there is no negative selector. - Subtract the negative set from the positive set, and run only the tests in the resulting set. Then 1-4 !3 and !3 1-4 would mean the same thing. Explanation of the semantics would be far simpler than we do it from left to right. One reason why the orders shouldn't matter is, unlike the print dialog case, we won't run tests out of order when given 1 4 3 2. We will still run 1-4. So it would be natural for the readers to expect that the orders they give selectors would not matter. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.
Nathan Collins nathan.coll...@gmail.com writes: But 'git apply' could be much more helpful than 'patch' even, since the presence or absence of the 'a/' and 'b/' prefixes in the patch, and the 'diff.noprefix' setting, give Git enough info to be very helpful to the user. The prefix would be unreliable as the generator may be using the mnemonicprefix option to use i/ and w/ prefixes. Worse yet, the configuration variables are for people who generated the diff you are feeding git apply, and there is nothing that tells apply that the patch is generated with _your_ setting. So that is not workable. However, Before issuing this error message git -c diff.noprefix=true diff HEAD~ | git apply --reverse error: Data/Function/Decorator/Memoizer/Unsafe.hs: No such file or directory we _could_ check that there is Data/ directory in the target tree the patch is being applied and suggest to: * use -p0, if noprefix, which I agree with Jonathan is an insane thing to use by default, is common enough; or * use different setting for -p$n, if noprefix is not common. in the error message. Extra computation necessary to do so would happen only in the error codepath, and we wouldn't mind spending some cycles if they help the end user. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/5] contrib/subtree/Makefile: Standardisation pass
James Denholm nod.h...@gmail.com writes: contrib/subtree/Makefile is a shambles in regards to it's consistency with other makefiles, which makes subtree overly painful to include in build scripts. The main issues are that calls are made to git itself in the build process, and that a subtree-exclusive variable is used for specifying the exec path. Patches 1/5 through 3/5 resolve these. The cleanup fixes (4/5 and 5/5) are based on precedents set by other makefiles across the project. One problem is foreseen: 3/5 will necessitate that package maintainers who already have git-subtree included in their packages update their build-scripts. Reviewed-by: Jeff King p...@peff.net Signed-off-by: James Denholm nod.h...@gmail.com Based-on-patch-by: Dan McGee dpmc...@gmail.com It is funny to see sign-off on 0/5 ;-) By the way, this is v3, not v2, no? It was somewhat confusing to see Peff saying filfre to add my reviewed-by on v2, noticing you posted something new, and not finding v3. Will queue. Thanks. James Denholm (5): contrib/subtree/Makefile: scrap unused $(gitdir) contrib/subtree/Makefile: Use GIT-VERSION-FILE contrib/subtree/Makefile: s/libexecdir/gitexecdir contrib/subtree/Makefile: Doc-gen rules cleanup contrib/subtree/Makefile: clean rule cleanup contrib/subtree/Makefile | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/5] contrib/subtree/Makefile: Standardisation pass
Junio C Hamano gits...@pobox.com wrote: It is funny to see sign-off on 0/5 ;-) Yeah, I wasn't quite sure of exact protocol, and sort-of defaulted to sign-all-the-things mode. By the way, this is v3, not v2, no? It was somewhat confusing to see Peff saying filfre to add my reviewed-by on v2, noticing you posted something new, and not finding v3. Ah, right. I thought that resending a post-discussion patch was the done thing, given Documentation/SubmittingPatches, but that a comment line might not have been worth a version bump. Will queue. Thanks. Awesome, thanks. Regards, James Denholm. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] pager: remove 'S' from $LESS by default
On Tue, May 06, 2014 at 08:49:22PM +0200, Matthieu Moy wrote: Exactly. I personally never use git blame outside git gui blame for this reason. I'd recommend tig blame for this, too, which behaves like less -S with respect to long lines (and also makes it easy to jump to the full diff, or restart the blame from the parent of the found commit). It's possible for a user to set pager.blame to less -S to get back to the previous behavior only for blame. The idea of having a separate default value for pager.blame (or set $LESS differently for blame) crossed my mind, but I actually don't like it, as it would make it harder for a user to fine-tune his configuration manually (one would have to cancel all the corner-cases that Git would set by default). Agreed. We already get some confusion from users with git has set $LESS for me. Changing it to git set up $LESS depending on which command is running seems like it would cause more of the same. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] config: preserve config file permissions on edits
On Tue, May 06, 2014 at 12:17:14AM +, Eric Wong wrote: Users may already store sensitive data such as imap.pass in .git/config; making the file world-readable when git config is called to edit means their password would be compromised on a shared system. Makes sense, and the patch looks good to me. +test_expect_success POSIXPERM,PERL 'preserves existing permissions' ' + chmod 0600 .git/config + git config imap.pass Hunter2 + perl -e \ + die q(badset) if ((stat(q(.git/config)))[2] 0) != 0600 I don't think we usually bother with a PERL prereq for running one-liners like this from the test script, though I don't think it hurts anything to do so. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Pull is Mostly Evil
Jeff King p...@peff.net writes: I realize this has veered off into talking about an update command, and not necessarily pull, but since there a lot of proposals floating around, I wanted to make one point: if we are going to do such a switch, let's please make it something the user explicitly turns on. I mentioned update in an attempt to suggest some way to avoid breaking git pull for people who do want to advane the history with real work (i.e. not just following along with fast-forwarding). A failed git push that suggests to pull first, which came from the original To emulate CVS workflow, you can pull, work, push, and if the push fails, pull again and then push in the early tutorial, turns out to be very bad in the trunk centric worldview. And I think the solution is to realize that we use git pull for two fairly differnt workflows. - You know you own the tip of the trunk (in the global view). You merge from other people to advance the global world view in a way that makes sense in the first-parent chain is the trunk worldview. That is what git pull [--no-ff] was designed to do, and it does it very well. - You have some work of yours (either you committed directly, you merged your own work done on a side branch, or you merged from other people using git pull) on top of a commit that used to be at the tip of the global world. You want to make sure that branch you are on is not missing what has happened while you are not communicating with the outside world. The problematic case is the latter, and by introducing a new command to do that well (which is *not* just about swapping the order of the parents, by the way), updating the leaf developer section of Everyday Git document and tutorials, and suggesting to use that upon failed git push, I think users would get a more pleasant experience. And move git pull into integrator section, a command that is not necessary for leaf developers. I am not married to the name update. I think the ideal behaviour of that leaf-developer command would be something along the lines of the following: - If we can fast-forward, do so and we are done. - Otherwise, we have a history of this shape: O \ -ABC \ X---Y---Z where A was where we forked, B was a merge the user made, C was a commit the user directly made, and X, Y, and Z (some of them may be merges) are the trunk history git pull would create a merge M whose parents are C Z, which is wrong from the first-parent is the trunk worldview. But recording the merge to have parents Z C does not give us the first-parent is the trunk worldview, in the presense of B. We would prefer to end up with a history more like this: -A O \ \ X---Y---Z---B'--C' so that your work, your contribution with two commits of yours, was to merge the work done on a side branch and then made one commit directly on top of it. Hence, I think the ideal behaviour of the new command is to replay the first-parent history on top of the updated tip of your upstream (which by the way is different from how rebase --preserve-merges works; it is more like how J6t wanted to make rebase --preserve-merges work, IIRC). After that, you can attempt to push, and it may fail again (because somebody has grown the shared history to have a child W of Z at the tip), in which case exactly the same git update would attempt to recreate a history of this shape: -A O \ \ X---Y---Z---W---B--C During a long transition period (essentially, waiting for the current crop of documents and tutorials to die out), we will need extra safety to prevent people, who merely wanted to bring their branch up to date, from running git pull, and I think the command needs to: - check which branch of what repository it is trying to pull; - check which branch of what repository it is going to update if git push is given; - if they are the same, then you are attempting to update from your upstream, so either warn or error out. If we are going to warn but make a merge anyway, the warning message *must* come at the very end of the output (and tell the user the way to recover is to reset one away and run the other command). Or something like that. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] After chdir to run grep, return to old directory
dtur...@twopensource.com writes: From: David Turner dtur...@twitter.com Signed-off-by: David Turner dtur...@twitter.com Ehh, why? --- builtin/grep.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/builtin/grep.c b/builtin/grep.c index 69ac2d8..e9fe040 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -355,15 +355,25 @@ static void run_pager(struct grep_opt *opt, const char *prefix) { struct string_list *path_list = opt-output_priv; const char **argv = xmalloc(sizeof(const char *) * (path_list-nr + 1)); + static char old_directory[PATH_MAX+1]; int i, status; for (i = 0; i path_list-nr; i++) argv[i] = path_list-items[i].string; argv[path_list-nr] = NULL; - if (prefix chdir(prefix)) - die(_(Failed to chdir: %s), prefix); + + if (prefix) { + if (!getcwd(old_directory, PATH_MAX+1)) + die(_(Failed to get cwd: %s), prefix); + if (chdir(prefix)) + die(_(Failed to chdir: %s), prefix); + } status = run_command_v_opt(argv, RUN_USING_SHELL); + if (prefix) + if (chdir(old_directory)) + die(_(Failed to chdir: %s), old_directory); + if (status) exit(status); free(argv); -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Re: material for git training sessions/presentations
Hi Felipe, Jordan McCullough here from the GitHub Training team. I noticed you were kind enough to open a Pull Request (linked below for reference) addressing this. We really do appreciate the contribution. I'll review the PR just as soon as I can, so anticipate a merge with your changes to the `color.ui` soon. https://github.com/github/training-kit/pull/118 Commit and Octocats, Jordan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] inline constant return from error() function
Jeff King p...@peff.net writes: Commit e208f9c introduced a macro to turn error() calls into: (error(), -1) to make the constant return value more visible to the calling code (and thus let the compiler make better decisions about the code). This works well for code like: return error(...); but the -1 is superfluous in code that just calls error() without caring about the return value. In older versions of gcc, that was fine, but gcc 4.9 complains with -Wunused-value. We can work around this by encapsulating the constant return value in a static inline function, as gcc specifically avoids complaining about unused function returns unless the function has been specifically marked with the warn_unused_result attribute. That's kind of W*A*T magic, and I generally try to avoid magic, as long as it solves your can we make both -O2 with new compilers and -O3 happy? I wouldn't complain ;-) We also use the same trick for config_error_nonbool and opterror, which learned the same error technique in a469a10. Reported-by: Felipe Contreras felipe.contre...@gmail.com Signed-off-by: Jeff King p...@peff.net --- On Mon, May 05, 2014 at 05:29:38PM -0400, Jeff King wrote: I cannot think of any other way to make the compiler aware of the constant value, but perhaps somebody else is more clever than I am. This came to me in a dream, and seems to work. cache.h | 2 +- git-compat-util.h | 6 +- parse-options.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 107ac61..e2f12b0 100644 --- a/cache.h +++ b/cache.h @@ -1272,7 +1272,7 @@ extern int git_env_bool(const char *, int); extern int git_config_system(void); extern int config_error_nonbool(const char *); #if defined(__GNUC__) ! defined(__clang__) -#define config_error_nonbool(s) (config_error_nonbool(s), -1) +#define config_error_nonbool(s) (config_error_nonbool(s), const_error()) #endif extern const char *get_log_output_encoding(void); extern const char *get_commit_output_encoding(void); diff --git a/git-compat-util.h b/git-compat-util.h index f6d3a46..b4c437e 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -331,7 +331,11 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))) * using the function as usual. */ #if defined(__GNUC__) ! defined(__clang__) -#define error(...) (error(__VA_ARGS__), -1) +static inline int const_error(void) +{ + return -1; +} +#define error(...) (error(__VA_ARGS__), const_error()) #endif extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params)); diff --git a/parse-options.h b/parse-options.h index 3189676..2f9be96 100644 --- a/parse-options.h +++ b/parse-options.h @@ -177,7 +177,7 @@ extern NORETURN void usage_msg_opt(const char *msg, extern int optbug(const struct option *opt, const char *reason); extern int opterror(const struct option *opt, const char *reason, int flags); #if defined(__GNUC__) ! defined(__clang__) -#define opterror(o,r,f) (opterror((o),(r),(f)), -1) +#define opterror(o,r,f) (opterror((o),(r),(f)), const_error()) #endif /*- incremental advanced APIs -*/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Pull is Mostly Evil
Junio C Hamano wrote: But recording the merge to have parents Z C does not give us the first-parent is the trunk worldview, in the presense of B. We would prefer to end up with a history more like this: -A O \ \ X---Y---Z---B'--C' so that your work, your contribution with two commits of yours, was to merge the work done on a side branch and then made one commit directly on top of it. Yes, _ideally_, but as it has been explained multiple times most Git beginners have no idea what is a rebase. We might evenaully do this by default, but first we should start rejecting the update by default and recommending `git update --merge` as it has been discussed quite a lot should be the behavior of `git pull`. Hence, I think the ideal behaviour of the new command is to replay the first-parent history on top of the updated tip of your upstream (which by the way is different from how rebase --preserve-merges works; it is more like how J6t wanted to make rebase --preserve-merges work, IIRC). What is the difference with 'rebase -p'? -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
What's cooking in git.git (May 2014, #01; Tue, 6)
Here are the topics that have been cooking. Commits prefixed with '-' are only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'. The tip of the 'master' branch has passed v2.0.0-rc1. Last minute fixes to newly added code keep flowing in, which is good. I've picked up some topics that will not be part of the upcoming release to 'pu' not to lose them, but I didn't have time to give them a deep reading. You can find the changes described here in the integration branches of the repositories listed at http://git-blame.blogspot.com/p/git-public-repositories.html -- [Graduated to master] * km/git-svn-workaround-older-getopt-long (2014-04-23) 1 commit (merged to 'next' on 2014-04-23 at 3f35586) + t9117: use --prefix instead of --prefix= Finishing touches to a change that is already in 'master'. * mk/doc-git-gui-display-untracked (2014-04-21) 1 commit (merged to 'next' on 2014-04-22 at 385d39a) + Documentation: git-gui: describe gui.displayuntracked * mw/symlinks (2014-04-24) 1 commit (merged to 'next' on 2014-04-25 at 20b2af6) + setup: fix windows path buffer over-stepping A finishing touch fix to a new change already in 'master'. * rh/prompt-pcmode-avoid-eval-on-refname (2014-04-22) 1 commit (merged to 'next' on 2014-04-22 at 3a1506f) + git-prompt.sh: don't put unsanitized branch names in $PS1 -- [New Topics] * bg/strbuf-trim (2014-04-30) 2 commits - api-strbuf.txt: Add docs for _trim and _ltrim - strbuf: Use _rtrim and _ltrim in strbuf_trim Will merge to 'next'. * cb/byte-order (2014-05-02) 2 commits - compat/bswap.h: restore preference __BIG_ENDIAN over BIG_ENDIAN - compat/bswap.h: detect endianness on more platforms that don't use BYTE_ORDER Will merge to 'next'. * dt/api-doc-setup-gently (2014-04-30) 1 commit - docs: document RUN_SETUP_GENTLY and clarify RUN_SETUP Will merge to 'next'. * dt/merge-recursive-case-insensitive (2014-05-06) 1 commit - merge-recursive.c: Fix case-changing merge bug * ew/config-protect-mode (2014-05-06) 1 commit - config: preserve config file permissions on edits Will merge to 'next'. * fc/rerere-conflict-style (2014-04-30) 1 commit - rerere: fix for merge.conflictstyle Will merge to 'next'. * jc/coding-guidelines (2014-05-02) 8 commits - CodingGuidelines: on splitting a long line - CodingGuidelines: on comparison - CodingGuidelines: do not call the conditional statement if() - CodingGuidelines: give an example for shell function preamble - CodingGuidelines: give an example for control statements - CodingGuidelines: give an example for redirection - CodingGuidelines: give an example for case/esac statement - CodingGuidelines: once it is in, it is not worth the code churn Needs to be rerolled. * jd/subtree (2014-05-06) 5 commits - contrib/subtree/Makefile: clean rule cleanup - contrib/subtree/Makefile: Doc-gen rules cleanup - contrib/subtree/Makefile: s/libexecdir/gitexecdir - contrib/subtree/Makefile: Use GIT-VERSION-FILE - contrib/subtree/Makefile: scrap unused $(gitdir) Will merge to 'next'. * jk/commit-date-approxidate (2014-05-02) 4 commits - commit: accept more date formats for --date - commit: print Date line when the user has set date - pretty: make show_ident_date public - commit: use split_ident_line to compare author/committer Will merge to 'next'. * mm/pager-less-sans-S (2014-04-30) 1 commit - pager: remove 'S' from $LESS by default Will merge to 'next'. * sk/msvc-dynlink-crt (2014-05-06) 1 commit - MSVC: link dynamically to the CRT Will merge to 'next'. -- [Stalled] * tr/merge-recursive-index-only (2014-02-05) 3 commits - merge-recursive: -Xindex-only to leave worktree unchanged - merge-recursive: internal flag to avoid touching the worktree - merge-recursive: remove dead conditional in update_stages() (this branch is used by tr/remerge-diff.) Will hold. * tr/remerge-diff (2014-02-26) 5 commits . log --remerge-diff: show what the conflict resolution changed . name-hash: allow dir hashing even when !ignore_case . merge-recursive: allow storing conflict hunks in index . revision: fold all merge diff variants into an enum merge_diff_mode . combine-diff: do not pass revs-dense_combined_merges redundantly (this branch uses tr/merge-recursive-index-only.) log -p output learns a new way to let users inspect a merge commit by showing the differences between the automerged result with conflicts the person who recorded the merge would have seen and the final conflict resolution that was recorded in the merge. Needs to be rebased, now kb/fast-hashmap topic is in. * jk/makefile (2014-02-05) 16 commits - FIXUP - move LESS/LV pager environment to Makefile - Makefile: teach scripts to include make variables - FIXUP - Makefile: auto-build C strings from make variables - Makefile: drop
[PATCH v2 0/2] add a reflog_exists and delete_reflog abstraction
This is a series adds two new functions to try to hide the reflog implementation details from the callers in checkout.c and reflog.c. It adds new functions to test if a reflog exists and to delete it, thus allowing checkout.c to perform this if-test-then-delete operation without having to know the internal implementation of reflogs (i.e. that they are files that live under .git/logs) Additionally we change checkout.c to use ref_exists instead of file_exists when checking for ref existence. This fixes a bug when checkout could delete a valid reflog file if the branch was a packed ref. The tests have been updated to test for this bug. Version 2: - Typos and fixes suggested by mhagger. - Break the checkout-deletes reflog bugfix out into a separate patch. Ronnie Sahlberg (2): refs.c: add new functions reflog_exists and delete_reflog checkout.c: use ref_exists instead of file_exist builtin/checkout.c | 8 ++-- builtin/reflog.c | 2 +- refs.c | 21 +++-- refs.h | 6 ++ t/t1410-reflog.sh | 8 5 files changed, 32 insertions(+), 13 deletions(-) -- 2.0.0.rc1.354.g7561c2b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/2] checkout.c: use ref_exists instead of file_exist
Change checkout.c to check if a ref exists instead of checking if a loose ref file exists when deciding if to delete an orphaned log file. Otherwise, if a ref only exists as a packed ref without a corresponding loose ref for the currently checked out branch, we risk that the reflog will be deleted when we switch to a different branch. Update the reflog tests to check for this bug. The following reproduces the bug: $ git init-db $ git config core.logallrefupdates true $ git commit -m Initial --allow-empty [master (root-commit) bb11abe] Initial $ git reflog master [8561dcb master@{0}: commit (initial): Initial] $ find .git/{refs,logs} -type f | grep master [.git/refs/heads/master] [.git/logs/refs/heads/master] $ git branch foo $ git pack-refs --all $ find .git/{refs,logs} -type f | grep master [.git/logs/refs/heads/master] $ git checkout foo $ find .git/{refs,logs} -type f | grep master ... reflog file is missing ... $ git reflog master ... nothing ... Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/checkout.c | 5 + t/t1410-reflog.sh | 8 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index 929f5bd..f1dc56e 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -651,10 +651,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts, } } if (old-path old-name) { - char ref_file[PATH_MAX]; - - git_snpath(ref_file, sizeof(ref_file), %s, old-path); - if (!file_exists(ref_file) reflog_exists(old-path)) + if (!ref_exists(old-path) reflog_exists(old-path)) delete_reflog(old-path); } } diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 236b13a..8cab06f 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -245,4 +245,12 @@ test_expect_success 'gc.reflogexpire=false' ' ' +test_expect_success 'checkout should not delete log for packed ref' ' + test $(git reflog master | wc -l) = 4 + git branch foo + git pack-refs --all + git checkout foo + test $(git reflog master | wc -l) = 4 +' + test_done -- 2.0.0.rc1.354.g7561c2b.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/2] refs.c: add new functions reflog_exists and delete_reflog
Add two new functions, reflog_exists and delete_reflog, to hide the internal reflog implementation (that they are files under .git/logs/...) from callers. Update checkout.c to use these functions in update_refs_for_switch instead of building pathnames and calling out to file access functions. Update reflog.c to use these to check if the reflog exists. Now there are still many places in reflog.c where we are still leaking the reflog storage implementation but this at least reduces the number of such dependencies by one. Finally change two places in refs.c itself to use the new function to check if a ref exists or not isntead of build-path-and-stat(). Now, this is strictly not all that important since these are in parts of refs that are implementing the actual file storage backend but on the other hand it will not hurt either. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/checkout.c | 7 +++ builtin/reflog.c | 2 +- refs.c | 21 +++-- refs.h | 6 ++ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index ff44921..929f5bd 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -651,12 +651,11 @@ static void update_refs_for_switch(const struct checkout_opts *opts, } } if (old-path old-name) { - char log_file[PATH_MAX], ref_file[PATH_MAX]; + char ref_file[PATH_MAX]; - git_snpath(log_file, sizeof(log_file), logs/%s, old-path); git_snpath(ref_file, sizeof(ref_file), %s, old-path); - if (!file_exists(ref_file) file_exists(log_file)) - remove_path(log_file); + if (!file_exists(ref_file) reflog_exists(old-path)) + delete_reflog(old-path); } } remove_branch_state(); diff --git a/builtin/reflog.c b/builtin/reflog.c index c12a9784..e8a8fb1 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -369,7 +369,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused, if (!lock) return error(cannot lock ref '%s', ref); log_file = git_pathdup(logs/%s, ref); - if (!file_exists(log_file)) + if (!reflog_exists(ref)) goto finish; if (!cmd-dry_run) { newlog_path = git_pathdup(logs/%s.lock, ref); diff --git a/refs.c b/refs.c index e59bc18..302a2b3 100644 --- a/refs.c +++ b/refs.c @@ -2013,7 +2013,6 @@ int dwim_log(const char *str, int len, unsigned char *sha1, char **log) *log = NULL; for (p = ref_rev_parse_rules; *p; p++) { - struct stat st; unsigned char hash[20]; char path[PATH_MAX]; const char *ref, *it; @@ -2022,12 +2021,9 @@ int dwim_log(const char *str, int len, unsigned char *sha1, char **log) ref = resolve_ref_unsafe(path, hash, 1, NULL); if (!ref) continue; - if (!stat(git_path(logs/%s, path), st) - S_ISREG(st.st_mode)) + if (reflog_exists(path)) it = path; - else if (strcmp(ref, path) -!stat(git_path(logs/%s, ref), st) -S_ISREG(st.st_mode)) + else if (strcmp(ref, path) reflog_exists(ref)) it = ref; else continue; @@ -3030,6 +3026,19 @@ int read_ref_at(const char *refname, unsigned long at_time, int cnt, return 1; } +int reflog_exists(const char *refname) +{ + struct stat st; + + return !lstat(git_path(logs/%s, refname), st) + S_ISREG(st.st_mode); +} + +int delete_reflog(const char *refname) +{ + return remove_path(git_path(logs/%s, refname)); +} + static int show_one_reflog_ent(struct strbuf *sb, each_reflog_ent_fn fn, void *cb_data) { unsigned char osha1[20], nsha1[20]; diff --git a/refs.h b/refs.h index c1cb4b4..8bd815d 100644 --- a/refs.h +++ b/refs.h @@ -159,6 +159,12 @@ extern int read_ref_at(const char *refname, unsigned long at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt); +/** Check if a particular reflog exists */ +extern int reflog_exists(const char *refname); + +/** Delete a reflog */ +extern int delete_reflog(const char *refname); + /* iterate over reflog entries */ typedef int each_reflog_ent_fn(unsigned char *osha1, unsigned char *nsha1, const char *, unsigned long, int, const char *, void *); int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn, void *cb_data); -- 2.0.0.rc1.354.g7561c2b.dirty -- To unsubscribe from this list: send the line
[PATCH 2/2] ignorecase: Fix git mv on insensitive filesystems
From: David Turner dtur...@twitter.com Make it possible to change the case of a filename on a case-insensitive filesystem using git mv. Change git mv to allow moves where the destination file exists if either the destination file has the same inode as the source file (for Mac) or the same name ignoring case (for Win). Signed-off-by: David Turner dtur...@twitter.com --- builtin/mv.c| 18 ++ t/t6039-merge-ignorecase.sh | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/builtin/mv.c b/builtin/mv.c index 45e57f3..8cead13 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -74,7 +74,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix) }; const char **source, **destination, **dest_path, **submodule_gitfile; enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes; - struct stat st; + struct stat src_st,dst_st; struct string_list src_for_dst = STRING_LIST_INIT_NODUP; gitmodules_config(); @@ -102,8 +102,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix) if (dest_path[0][0] == '\0') /* special case: . was normalized to */ destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME); - else if (!lstat(dest_path[0], st) - S_ISDIR(st.st_mode)) { + else if (!lstat(dest_path[0], dst_st) + S_ISDIR(dst_st.st_mode)) { dest_path[0] = add_slash(dest_path[0]); destination = internal_copy_pathspec(dest_path[0], argv, argc, DUP_BASENAME); } else { @@ -122,13 +122,13 @@ int cmd_mv(int argc, const char **argv, const char *prefix) printf(_(Checking rename of '%s' to '%s'\n), src, dst); length = strlen(src); - if (lstat(src, st) 0) + if (lstat(src, src_st) 0) bad = _(bad source); else if (!strncmp(src, dst, length) (dst[length] == 0 || dst[length] == '/')) { bad = _(can not move directory into itself); - } else if ((src_is_dir = S_ISDIR(st.st_mode)) -lstat(dst, st) == 0) + } else if ((src_is_dir = S_ISDIR(src_st.st_mode)) +lstat(dst, dst_st) == 0) bad = _(cannot move directory over file); else if (src_is_dir) { int first = cache_name_pos(src, length); @@ -202,14 +202,16 @@ int cmd_mv(int argc, const char **argv, const char *prefix) } } else if (cache_name_pos(src, length) 0) bad = _(not under version control); - else if (lstat(dst, st) == 0) { + else if (lstat(dst, dst_st) == 0 +(src_st.st_ino != dst_st.st_ino || + (src_st.st_ino == 0 strcasecmp(src, dst { bad = _(destination exists); if (force) { /* * only files can overwrite each other: * check both source and destination */ - if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { + if (S_ISREG(dst_st.st_mode) || S_ISLNK(dst_st.st_mode)) { if (verbose) warning(_(overwriting '%s'), dst); bad = NULL; diff --git a/t/t6039-merge-ignorecase.sh b/t/t6039-merge-ignorecase.sh index ad06752..28cfb49 100755 --- a/t/t6039-merge-ignorecase.sh +++ b/t/t6039-merge-ignorecase.sh @@ -35,7 +35,7 @@ test_expect_success 'merge with case-changing rename on both sides' ' git reset --hard baseline git branch -D with-camel git checkout -b with-camel - git mv --force TestCase testcase + git mv TestCase testcase git commit -m recase on branch foo git add foo -- 2.0.0.rc0.33.g27630aa -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] merge-recursive.c: Fix case-changing merge.
From: David Turner dtur...@twitter.com On a case-insensitive filesystem, when merging, a file would be wrongly deleted from the working tree if an incoming commit had renamed it changing only its case. When merging a rename, the file with the old name would be deleted -- but since the filesystem considers the old name to be the same as the new name, the new file would in fact be deleted. We avoid this by not deleting files that have a case-clone in the index at stage 0. Signed-off-by: David Turner dtur...@twitter.com --- merge-recursive.c | 6 + t/t6039-merge-ignorecase.sh | 53 + 2 files changed, 59 insertions(+) create mode 100755 t/t6039-merge-ignorecase.sh diff --git a/merge-recursive.c b/merge-recursive.c index 4177092..cab16fa 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -589,6 +589,12 @@ static int remove_file(struct merge_options *o, int clean, return -1; } if (update_working_directory) { + if (ignore_case) { + struct cache_entry *ce; + ce = cache_file_exists(path, strlen(path), ignore_case); + if (ce ce_stage(ce) == 0) + return 0; + } if (remove_path(path)) return -1; } diff --git a/t/t6039-merge-ignorecase.sh b/t/t6039-merge-ignorecase.sh new file mode 100755 index 000..ad06752 --- /dev/null +++ b/t/t6039-merge-ignorecase.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +test_description='git-merge with case-changing rename on case-insensitive file system' + +. ./test-lib.sh + +if ! test_have_prereq CASE_INSENSITIVE_FS +then + skip_all='skipping case insensitive tests - case sensitive file system' + test_done +fi + +test_expect_success 'merge with case-changing rename' ' + test $(git config core.ignorecase) = true +TestCase + git add TestCase + git commit -m add TestCase + git tag baseline + git checkout -b with-camel +foo + git add foo + git commit -m intervening commit + git checkout master + git rm TestCase +testcase + git add testcase + git commit -m rename to testcase + git checkout with-camel + git merge master -m merge + test -e testcase +' + +test_expect_success 'merge with case-changing rename on both sides' ' + git checkout master + git reset --hard baseline + git branch -D with-camel + git checkout -b with-camel + git mv --force TestCase testcase + git commit -m recase on branch +foo + git add foo + git commit -m intervening commit + git checkout master + git rm TestCase +testcase + git add testcase + git commit -m rename to testcase + git checkout with-camel + git merge master -m merge + test -e testcase +' + +test_done -- 2.0.0.rc0.33.g27630aa -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: What's cooking in git.git (May 2014, #01; Tue, 6)
Junio C Hamano wrote: * fc/remote-helpers-hg-bzr-graduation (2014-04-29) 11 commits - remote-hg: trivial cleanups - remote-hg: make sure we omit multiple heads - git-remote-hg: use internal clone's hgrc - t: remote-hg: split into setup test - remote-hg: properly detect missing contexts - remote-{hg,bzr}: store marks only on success - remote-hg: update to 'public' phase when pushing - remote-hg: fix parsing of custom committer (merged to 'next' on 2014-04-22 at fed170a) + remote-helpers: move tests out of contrib + remote-helpers: move out of contrib + remote-helpers: squelch python import exceptions Move remote-hg and remote-bzr out of contrib/. There were some suggestions on the follow-up fix patches still not in 'next', which may result in a reroll. I've no idea what suggestions you are talking about. I tend to agree with John Keeping that remote helpers that are actively maintained can and should aim to graduate from my tree and given to the user directly. Wait, I was under the impression the graduation was going to happen for v2.0. I don't understand what is the point of preparing the v2.0 for so long, and then all of a sudden tag v2.0.0-rc0 and say oops! if you wanted to get something into v2.0 it's too late now, wait another 2-10 years for important changes to get merged. Such a wasted opportunity and such a disappointing release. Therefore the release notes are still lying to the users: * git push via transport-helper interface (e.g. remote-hg) has been updated to allow ref deletion in a way similar to the natively supported transports. That is not true. These should obviously be part of the v2.0: * fc/remote-helpers-hg-bzr-graduation (2014-04-29) 11 commits + remote-helpers: move tests out of contrib + remote-helpers: move out of contrib + remote-helpers: squelch python import exceptions - remote-{hg,bzr}: store marks only on success * fc/remote-helper-refmap (2014-04-21) 8 commits (merged to 'next' on 2014-04-22 at fb5a4c2) + transport-helper: remove unnecessary strbuf resets + transport-helper: add support to delete branches + fast-export: add support to delete refs + fast-import: add support to delete refs + transport-helper: add support to push symbolic refs + transport-helper: add support for old:new refspec + fast-export: add new --refspec option + fast-export: improve argument parsing * fc/merge-default-to-upstream (2014-04-22) 1 commit + merge: enable defaulttoupstream by default * fc/mergetool-prompt (2014-04-24) 2 commits + mergetool: document the default for --[no-]prompt + mergetool: run prompt only if guessed tool Plus this one which has been completely ignored: completion: move out of contrib Since you are not going to do so, I do not feel compelled to fix the synchronization crash regression that is present in v2.0.0-rc2 and I already warned you about. -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (May 2014, #01; Tue, 6)
Felipe Contreras felipe.contre...@gmail.com writes: Therefore the release notes are still lying to the users: * git push via transport-helper interface (e.g. remote-hg) has been updated to allow ref deletion in a way similar to the natively supported transports. That is not true. Hmph, you are right. I somehow mislabeled the series that ends at a7cb1276cc263446b19b43d3a7784cbc72f84e28 dealing with delete, when the series actually is about forcing. Will update. Plus this one which has been completely ignored: completion: move out of contrib It is not about ignored. It is about running out of time before concluding the day's integration. I can hopefully queue it on 'pu' tomorrow, and depending on the reviews or lack of reviews, it may advance on its own pace from there. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (May 2014, #01; Tue, 6)
Junio C Hamano wrote: Felipe Contreras felipe.contre...@gmail.com writes: Plus this one which has been completely ignored: completion: move out of contrib It is not about ignored. It is about running out of time before concluding the day's integration. A comment doesn't require integration. Either way the rest of the patches have already advanced. -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (Apr 2014, #09; Tue, 29)
John Keeping j...@keeping.me.uk writes: I'd like to register my opposition to moving git-remote-{bzr,hg} out of contrib/. I am not convinced that tools for interoperating with other VCSs need to be part of core Git; as Junio has pointed out previously, while contrib/ was necessary ... Associated tools can therefore live on their own and do not need to be promoted as part of Git itself (as git-imerge is doing successfully). Another thing to keep in mind is that we need to ensure that we give a good way for these third-party tools to integrate well with the core Git tools to form a single toolchest for the users. I would love to be able to do $ (cd git.git make install) $ (cd git-imerge.git make install) and then say git imerge, git --help imerge, etc. The same for the remote helpers that we may be splitting out of my tree into their own stand-alone projects. I _think_ it probably is OK for git-imerge.git/Makefile to peek into our Makefile, e.g. $ cd git-imerge.git $ make GIT_SOURCE_DIR=../git.git install to learn where imerge should install its subcommand implementation and documentation. It might even want to borrow the test framework by using $GIT_SOURCE_DIR/t/test-lib.sh or somesuch. There may be some changes the third-party tool authors would want to have in our Makefile to help them better when building their tools this way; I dunno. I also think that there should be a way to make it really easy to install these third-party tools to augment the installed version of Git without having the source tree of Git. We have ways for them to ask us where things are expected to be, e.g. $ git --html-path $ git --man-path $ git --exec-path but I am not sure if these are enough, or if it would help them to add a bit more, then what these a bit more are. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] After chdir to run grep, return to old directory
On Tue, 2014-05-06 at 15:24 -0700, Junio C Hamano wrote: dtur...@twopensource.com writes: From: David Turner dtur...@twitter.com Signed-off-by: David Turner dtur...@twitter.com Ehh, why? Briefly, because otherwise ./t7811-grep-open.sh fails when run under watchman. This is actually something that I think I'm doing wrong, but I can't see what the sensible way to do it is. When we go to write the fs_cache (in an atexit hook), we use get_fs_cache_file() from environment.c. This is a relative path, because all of the other similar paths are. So if we have chdired, then we fail. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (Apr 2014, #09; Tue, 29)
Junio C Hamano wrote: I _think_ it probably is OK for git-imerge.git/Makefile to peek into our Makefile, e.g. $ cd git-imerge.git $ make GIT_SOURCE_DIR=../git.git install to learn where imerge should install its subcommand implementation and documentation. It might even want to borrow the test framework by using $GIT_SOURCE_DIR/t/test-lib.sh or somesuch. Since Git's test framework heavily tied to git.git, sharness[1] is the only sensible option. It might not have all the latest features of Git's test framework, but it's standalone. [1] https://github.com/mlafeldt/sharness -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] completion: move out of contrib
Felipe Contreras felipe.contre...@gmail.com writes: These have been stable and widely used for quite a long time, they even have tests outside of the contrib area, and most distributions ship them, so they can be considered part of the core already. Let's move them out of contrib and install them by default. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Makefile | 5 - {contrib/completion = shared}/git-completion.bash | 0 {contrib/completion = shared}/git-completion.zsh | 0 {contrib/completion = shared}/git-prompt.sh | 0 t/t9902-completion.sh | 2 +- t/t9903-bash-prompt.sh | 2 +- 6 files changed, 6 insertions(+), 3 deletions(-) rename {contrib/completion = shared}/git-completion.bash (100%) rename {contrib/completion = shared}/git-completion.zsh (100%) rename {contrib/completion = shared}/git-prompt.sh (100%) I am not sure whom this change is meant to help. - Those who build from source *and* care about having the latest completion must already have a way they have been using to install them. They will have to change their procedure to adjust for the change of the path, *and* disable the part of install that installs it to $(sharedir) which is unlikely to match where they have been installing completion scripts. - Those who package completion for distros already have a way they have been using to install them. They suffer the same as those who build from the source. - Those who use pre-packaged Git and completion scripts would not care. - Those who have *not* installed from the source may benefit for being able to say make install and let it be installed, but they have to dot-include /usr/share/git-completion.bash location, which is new, not from /etc/bash_completion.d/git as they are used to. A better change might be to give a new Makefile target, perhaps $ make install.contrib-completion without moving the scripts from their current place. That way, nobody gets hurt, and those who are new to Git who want to build and install from the source would not have to invent their own way to install stuff from contrib/ (the same goes for other contrib/ tools such as contrib/workdir/ we may want to add a new target to let you say make install.contrib-workdir). I _may_ be persuaded to fold the installation of all possible contrib/ stuff into the regular make install, but I haven't thought things through. The patch does two unrelated things: - Move things in the source tree. - Install the completion by default. I very much agree that the latter may be a good thing to have in the polished end result. I am not sure if the installation location chosen is sensible. At least, another redirection git_completion_dir = $(sharedir) may be necessary to allow people install these in the location they want. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG?] Patches created with 'diff.noprefix=true' don't 'git apply'.
On Tue, May 6, 2014 at 2:12 PM, Junio C Hamano gits...@pobox.com wrote: Nathan Collins nathan.coll...@gmail.com writes: But 'git apply' could be much more helpful than 'patch' even, since the presence or absence of the 'a/' and 'b/' prefixes in the patch, and the 'diff.noprefix' setting, give Git enough info to be very helpful to the user. The prefix would be unreliable as the generator may be using the mnemonicprefix option to use i/ and w/ prefixes. Worse yet, the configuration variables are for people who generated the diff you are feeding git apply, and there is nothing that tells apply that the patch is generated with _your_ setting. More concretely, what I had in mind was that if 'diff.noprefix=true' is set in the user's config, and the patch is in '-p0' format, then Git could suggest to the user that the 'diff.noprefix' setting *might* be causing them to generate '-p0' patches. If the user had in fact not generated the patch themselves, then they could safely ignore the suggestion. But this may just be an overcomplicated solution to my and others' misuse of the 'diff.noprefix' option; see below. So that is not workable. However, Before issuing this error message git -c diff.noprefix=true diff HEAD~ | git apply --reverse error: Data/Function/Decorator/Memoizer/Unsafe.hs: No such file or directory we _could_ check that there is Data/ directory in the target tree the patch is being applied and suggest to: To clarify, the actual path was src/Data/Function/Decorator/Memoizer/Unsafe.hs The path in the error message, Data/Function/Decorator/Memoizer/Unsafe.hs was the '-p1' version of that path. This is extra confusing if the user is unfamiliar with the '-p' option for patch and unaware that 'git apply' is assuming '-p1'. * use -p0, if noprefix, which I agree with Jonathan is an insane thing to use by default, is common enough; or * use different setting for -p$n, if noprefix is not common. in the error message. Extra computation necessary to do so would happen only in the error codepath, and we wouldn't mind spending some cycles if they help the end user. I'm starting to think there are really two separate issues here: 1. 'git apply' doesn't give a very helpful error message when the patch does not apply due to not being in '-p1' format. 2. the 'diff.noprefix=true' option is used for two unrelated things in practice. One of them is related to diffing -- namely, making Git generate '-p0' patches -- and the other is unrelated to diffing -- namely, users want file names that can be easily copied with double-click. For (1), I think the solution is check if the patch makes sense as '-p0', in the error case, and tell the user about this in the error message as you suggested above. In fact, in case the '-p1' path doesn't exist, Git could just try all possible '-p$n' values, and report the first that yields valid paths, if any. Mentioning to the user that they have 'diff.noprefix=true' set in case '-p0' is discovered might be helpful, but a better solution to (2) might eliminate this problem in practice. For (2), the solution may be to add a separate 'diff.add-clickable-paths' option (probably there is a better name? 'diff.add-copyable-paths'? ...), which makes Git insert clickable paths in the comments in the diff output. This handles the clickable-paths use case which lead me and others to abuse 'diff.noprefix=true'. Examples where people suggest using 'diff.noprefix=true' to make it easier to double-click copy paths include [1 - 5]. Examples where people suggest using 'noprefix' to generate '-p0' patches include [6 - 10]. Concretely, if 'diff.add-clickable-paths' is set, then instead of e.g. diff --git a/src/Data/Function/Decorator/Memoizer/Unsafe.hs b/src/Data/Function/Decorator/Memoizer index 3ef17da..a0586d3 100644 --- a/src/Data/Function/Decorator/Memoizer/Unsafe.hs +++ b/src/Data/Function/Decorator/Memoizer/Unsafe.hs we get e.g. # src/Data/Function/Decorator/Memoizer/Unsafe.hs diff --git a/src/Data/Function/Decorator/Memoizer/Unsafe.hs b/src/Data/Function/Decorator/Memoizer index 3ef17da..a0586d3 100644 --- a/src/Data/Function/Decorator/Memoizer/Unsafe.hs +++ b/src/Data/Function/Decorator/Memoizer/Unsafe.hs as the diff header. In any case, warning the user in the 'diff.noprefix' docs that the point of the option is to create '-p0' patches, and that setting this permanently will cause bad interactions with other Git commands (like 'git apply') seems like a great idea -- you suggested this in your first email, but I hadn't really understood why my use of 'diff.noprefix' was insane yet. This probably won't help people that blindly use 'noprefix' in the insane way based on a suggestion they found with Google, but it can't hurt. If there were a 'diff.add-clickable-paths' option, then the 'diff.noprefix' docs could also mention this, and suggest the user use that instead if their use case is the easy copy use case. Thank you
Re: [PATCH] completion: move out of contrib
Junio C Hamano wrote: Felipe Contreras felipe.contre...@gmail.com writes: These have been stable and widely used for quite a long time, they even have tests outside of the contrib area, and most distributions ship them, so they can be considered part of the core already. Let's move them out of contrib and install them by default. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Makefile | 5 - {contrib/completion = shared}/git-completion.bash | 0 {contrib/completion = shared}/git-completion.zsh | 0 {contrib/completion = shared}/git-prompt.sh | 0 t/t9902-completion.sh | 2 +- t/t9903-bash-prompt.sh | 2 +- 6 files changed, 6 insertions(+), 3 deletions(-) rename {contrib/completion = shared}/git-completion.bash (100%) rename {contrib/completion = shared}/git-completion.zsh (100%) rename {contrib/completion = shared}/git-prompt.sh (100%) I am not sure whom this change is meant to help. - Those who build from source *and* care about having the latest completion must already have a way they have been using to install them. They will have to change their procedure to adjust for the change of the path, *and* disable the part of install that installs it to $(sharedir) which is unlikely to match where they have been installing completion scripts. No. - Those who package completion for distros already have a way they have been using to install them. They suffer the same as those who build from the source. Yes, *if* they have been packaging them, they have a way. But what if they haven't been doing so? And for the ones that have a way, now they need one hack less. - Those who use pre-packaged Git and completion scripts would not care. No. - Those who have *not* installed from the source may benefit for being able to say make install and let it be installed, but they have to dot-include /usr/share/git-completion.bash location, which is new, not from /etc/bash_completion.d/git as they are used to. Wrong. They don't have to dot-include anything, bash-completion does that automagically. If they don't have bash-completion, sure, they'll need to dot-include the new location. And the location is not /usr/share/git-completion.bash, it's $(sharedir)/bash-completion/completions. Although after reading bash-completion's README, it should actually be: % pkg-config --variable=completionsdir bash-completion A better change might be to give a new Makefile target, perhaps $ make install.contrib-completion without moving the scripts from their current place. But they are not contrib, they are part of the core, and should be distributed by default. That way, nobody gets hurt, and those who are new to Git who want to build and install from the source would not have to invent their own way to install stuff from contrib/ (the same goes for other contrib/ tools such as contrib/workdir/ we may want to add a new target to let you say make install.contrib-workdir). There is already a way to install from contrib. % make -C contrib/remote-helpers install The fact that you never picked my fixes to make it so is another matter. I _may_ be persuaded to fold the installation of all possible contrib/ stuff into the regular make install, but I haven't thought things through. But the completions are not contrib, they are essentially part of the core. If you want to demote them to contrib, then they shouldn't be tested by default, and t9902-completion.sh and t9903-bash-prompt.sh should be moved out to contrib. You cannot have your cake and eat it at the same time. The patch does two unrelated things: - Move things in the source tree. - Install the completion by default. I very much agree that the latter may be a good thing to have in the polished end result. I am not sure if the installation location chosen is sensible. At least, another redirection git_completion_dir = $(sharedir) may be necessary to allow people install these in the location they want. ifneq ($(prefix),$(HOME)) bashcompletiondir := $(shell pkg-config --variable=completionsdir bash-completion 2 /dev/null) endif ifndef bashcompletiondir bashcompletiondir = $(sharedir)/bash-completion/completions endif -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Kitchen Design Lancashire Reviews
I would recommend Kitchen Design Lancashire any day of the week. - Kitchen Design Lancashire Reviews -- View this message in context: http://git.661346.n2.nabble.com/Kitchen-Design-Lancashire-Reviews-tp7609861.html Sent from the git mailing list archive at Nabble.com. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] After chdir to run grep, return to old directory
On Tue, May 06, 2014 at 05:06:51PM -0700, David Turner wrote: On Tue, 2014-05-06 at 15:24 -0700, Junio C Hamano wrote: dtur...@twopensource.com writes: From: David Turner dtur...@twitter.com Signed-off-by: David Turner dtur...@twitter.com Ehh, why? Briefly, because otherwise ./t7811-grep-open.sh fails when run under watchman. This is actually something that I think I'm doing wrong, but I can't see what the sensible way to do it is. When we go to write the fs_cache (in an atexit hook), we use get_fs_cache_file() from environment.c. This is a relative path, because all of the other similar paths are. So if we have chdired, then we fail. It sounds like a reasonable code-hygiene thing, too. It looks like we are only doing the chdir to impact the environment of the pager, and affecting the global environment of the parent process is a side effect. It happens not to cause problems now because we exit immediately, but anybody who adds code after run_pager has to deal with it (and that is basically what you are doing here). Something like cleaning up tempfiles would be similarly affected. That being said, this really seems like something that the run-command interface should be doing, since it can handle the chdir in the forked child. And indeed, it seems to support that. Maybe: -- 8 -- Subject: grep: use run-command's dir option for --open-files-in-pager Git generally changes directory to the repository root on startup. When running grep --open-files-in-pager from a subdirectory, we chdir back to the original directory before running the pager, so that we can feed the relative pathnames to the pager. We currently do this chdir manually, but we can ask run_command to do it for us. This is fewer lines of code, and as a bonus, the chdir is limited to the child process, which avoids any unexpected surprises for code running after the pager (there isn't any currently, but this is future-proofing). Signed-off-by: Jeff King p...@peff.net --- builtin/grep.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/grep.c b/builtin/grep.c index 69ac2d8..43af5b7 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -361,9 +361,7 @@ static void run_pager(struct grep_opt *opt, const char *prefix) argv[i] = path_list-items[i].string; argv[path_list-nr] = NULL; - if (prefix chdir(prefix)) - die(_(Failed to chdir: %s), prefix); - status = run_command_v_opt(argv, RUN_USING_SHELL); + status = run_command_v_opt_cd_env(argv, RUN_USING_SHELL, prefix, NULL); if (status) exit(status); free(argv); -- 2.0.0.rc1.436.g03cb729 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] inline constant return from error() function
On Tue, May 06, 2014 at 03:29:37PM -0700, Junio C Hamano wrote: We can work around this by encapsulating the constant return value in a static inline function, as gcc specifically avoids complaining about unused function returns unless the function has been specifically marked with the warn_unused_result attribute. That's kind of W*A*T magic, and I generally try to avoid magic, as long as it solves your can we make both -O2 with new compilers and -O3 happy? I wouldn't complain ;-) I agree it's rather magical, but I think it's something we can count on. Certainly turning on warn_unused_result for every function would be a catastrophe for most code bases, and I don't expect gcc to do it. It's possible it would eventually grow smart to say eh, I inlined this and realized that you don't use the return value, but I think that would be similarly a bad idea. And it does work with -O2 and -O3 with both gcc-4.9 and clang in my tests. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] After chdir to run grep, return to old directory
This causes my test to pass and generally seems correct to me. On Tue, 2014-05-06 at 23:00 -0400, Jeff King wrote: ... That being said, this really seems like something that the run-command interface should be doing, since it can handle the chdir in the forked child. And indeed, it seems to support that. Maybe: -- 8 -- Subject: grep: use run-command's dir option for --open-files-in-pager Git generally changes directory to the repository root on startup. When running grep --open-files-in-pager from a subdirectory, we chdir back to the original directory before running the pager, so that we can feed the relative pathnames to the pager. We currently do this chdir manually, but we can ask run_command to do it for us. This is fewer lines of code, and as a bonus, the chdir is limited to the child process, which avoids any unexpected surprises for code running after the pager (there isn't any currently, but this is future-proofing). Signed-off-by: Jeff King p...@peff.net --- builtin/grep.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/grep.c b/builtin/grep.c index 69ac2d8..43af5b7 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -361,9 +361,7 @@ static void run_pager(struct grep_opt *opt, const char *prefix) argv[i] = path_list-items[i].string; argv[path_list-nr] = NULL; - if (prefix chdir(prefix)) - die(_(Failed to chdir: %s), prefix); - status = run_command_v_opt(argv, RUN_USING_SHELL); + status = run_command_v_opt_cd_env(argv, RUN_USING_SHELL, prefix, NULL); if (status) exit(status); free(argv); -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git fast-import: how to prevent incremental commit with no changes
On Tue, 06 May 2014 12:18:16 -0700 Junio C Hamano gits...@pobox.com wrote: Timo Teras timo.te...@iki.fi writes: I'm trying to script a setup that would periodically import a tarball to git with fast-import. But things do not always change, so I'd like fast-import to be able to not do the commit in case there is no change. That is, I'm constructing the commit with deleteall + importing each object by mark after that. Now, in case nothing changed, fast-import will happily create an empty commit for me. Would it be possible to add some flag that would make commit fail in case nothing changed? Any suggestions how to do this? I am not sure if such a conditional logically belongs to what fast-import does. Would it be an option for your script to rewind the HEAD after the import is done and it finds that the tarball did not have anything interesting new? Yes, this is what I ended up with for now. I wanted to avoid this mostly so that I would not need to run git gc --prune=now or similar after each import (or at least not often). Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] git-p4: format-patch to diff-tree change breaks binary patches
When applying binary patches a full index is required. format-patch already handles this, but diff-tree needs '--full-index' argument to always output full index. When git-p4 runs git-apply to test the patch, git-apply rejects the patch due to abbreviated blob object names. This is the error message git-apply emits in this case: error: cannot apply binary patch to 'filename' without full index line error: filename: patch does not apply Signed-off-by: Tolga Ceylan tolga.cey...@gmail.com Acked-by: Pete Wyckoff p...@padd.com --- git-p4.py |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-p4.py b/git-p4.py index cdfa2df..4ee6739 100755 --- a/git-p4.py +++ b/git-p4.py @@ -1311,7 +1311,7 @@ class P4Submit(Command, P4UserMap): else: die(unknown modifier %s for %s % (modifier, path)) -diffcmd = git diff-tree -p \%s\ % (id) +diffcmd = git diff-tree --full-index -p \%s\ % (id) patchcmd = diffcmd + | git apply tryPatchCmd = patchcmd + --check - applyPatchCmd = patchcmd + --check --apply - -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html