diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-08-02 19:22:28 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-08-03 20:37:19 +0100 |
commit | f871bade5ee513f8367ebb35a843778df61eaed2 (patch) | |
tree | f20a4ce1538ff80eca358b24c2928d3f10137df7 | |
parent | 8a6027965b4f02552cf754f9ec081e35c7174146 (diff) |
worktree support: dgit: Fix for .git/info/attributes
Experimentally, this file is in the common dir, not the per-worktree
dir. Honour $maindir_gitcommon everywhere.
Rename `open_main_gitattrs'. Previously it could in theory be used in
the playtree (but, it isn't). Now it always operates on the main
tree.
Indeed, as we require, the `setup' stuff is only done in the main
tree. The gitattributes fixes for playtrees are done,
unconditionally, with the much simpler hammer in playtree_setup.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | dgit | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -3266,8 +3266,9 @@ sub setup_mergechangelogs (;$) { my $driver = 'dpkg-mergechangelogs'; my $cb = "merge.$driver"; - my $attrs = '.git/info/attributes'; - ensuredir '.git/info'; + confess unless defined $maindir; + my $attrs = "$maindir_gitcommon/info/attributes"; + ensuredir "$maindir_gitcommon/info"; open NATTRS, ">", "$attrs.new" or die "$attrs.new $!"; if (!open ATTRS, "<", $attrs) { @@ -3312,15 +3313,15 @@ sub ensure_setup_existing_tree () { set_local_git_config $k, 'true'; } -sub open_gitattrs () { - my $gai = new IO::File ".git/info/attributes" +sub open_main_gitattrs () { + my $gai = new IO::File "$maindir_gitcommon/info/attributes" or $!==ENOENT - or die "open .git/info/attributes: $!"; + or die "open $maindir_gitcommon/info/attributes: $!"; return $gai; } sub is_gitattrs_setup () { - my $gai = open_gitattrs(); + my $gai = open_main_gitattrs(); return 0 unless $gai; while (<$gai>) { return 1 if m{^\[attr\]dgit-defuse-attrs\s}; @@ -3340,15 +3341,15 @@ sub setup_gitattrs (;$) { END return; } - my $af = ".git/info/attributes"; - ensuredir '.git/info'; + my $af = "$maindir_gitcommon/info/attributes"; + ensuredir "$maindir_gitcommon/info"; open GAO, "> $af.new" or die $!; print GAO <<END or die $!; * dgit-defuse-attrs [attr]dgit-defuse-attrs $negate_harmful_gitattrs # ^ see GITATTRIBUTES in dgit(7) and dgit setup-new-tree in dgit(1) END - my $gai = open_gitattrs(); + my $gai = open_main_gitattrs(); if ($gai) { while (<$gai>) { chomp; |