From: Carl Worth Date: Sun, 5 Jul 2020 18:41:04 +0000 (-0700) Subject: Provide the merge=union semantics we want through an info/attributes file X-Git-Url: https://git.cworth.org/git?p=nogit;a=commitdiff_plain;h=31ce062d961cbcc505abe5e2744c14ccf1885818 Provide the merge=union semantics we want through an info/attributes file This is much cleaner than we were doing before, (where we requiring a nogit repository to provide its own .giattribtues file with the merge=union configuration). This is also much cleaner than an approach we had been considering which was to temporarily move away any .gitattributes file, replacing it with our own for the time of "nogit sync", and then restoring it. Here, we take advantage of the define git semantics that: 1. A clone does not bring down .git/info/attributes so we are guaranteed to be safe to provide our own content here. 2. The content we provide in .git/info/attributes overrides anything set in any .gitattributes files so we can be confident that our configuration here will apply in all cases. --- diff --git a/nogit b/nogit index d55124d..b0820fc 100755 --- a/nogit +++ b/nogit @@ -97,6 +97,12 @@ nogit_clone() false fi + # Install the info/atttributes file that forces the "union" merge + # driver for all files, giving us the semantics of "keep both sides + # of all conflicts" that is at the heart of nogit. + mkdir -p tmp/.git/info + echo '* merge=union' > tmp/.git/info/attributes + # Now that we've passed the sanity check, install the cloned .git # object store into $NOGIT_DIR, cleanup our temporary files, and # checkout the (known to not be conflicting) files.