git/merge: correctly preserve permissions when merging
when doing a 3 way merge of a file, we also need to do a merge of the permission bits to avoid clobberign them.
This commit is contained in:
parent
1470d22cdb
commit
5dd9b370a0
1 changed files with 14 additions and 4 deletions
|
@ -29,14 +29,24 @@ fn drop {
|
||||||
' $*
|
' $*
|
||||||
}
|
}
|
||||||
|
|
||||||
fn present {
|
fn mergeperm {
|
||||||
if(~ $1 /dev/null && cmp $2 $3>/dev/null)
|
if(~ $1 /dev/null && cmp $2 $3>/dev/null)
|
||||||
status=gone
|
status=gone
|
||||||
if not if (~ $3 /dev/null && cmp $1 $2>/dev/null)
|
if not if (~ $3 /dev/null && cmp $1 $2>/dev/null)
|
||||||
status=gone
|
status=gone
|
||||||
if not
|
if not {
|
||||||
|
mergedperms='-x'
|
||||||
|
if(test -x $2){
|
||||||
|
if(test -x $1 -a -x $3)
|
||||||
|
mergedperms='+x'
|
||||||
|
}
|
||||||
|
if not{
|
||||||
|
if(test -x $1 -o -x $3)
|
||||||
|
mergedperms='+x'
|
||||||
|
}
|
||||||
status=()
|
status=()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn whoami{
|
fn whoami{
|
||||||
name=`$nl{git/conf user.name}
|
name=`$nl{git/conf user.name}
|
||||||
|
@ -73,13 +83,13 @@ fn merge1 {@{
|
||||||
base=/dev/null
|
base=/dev/null
|
||||||
if(! test -f $theirs)
|
if(! test -f $theirs)
|
||||||
theirs=/dev/null
|
theirs=/dev/null
|
||||||
mkdir -p `{basename -d $tmp}
|
|
||||||
if(! ape/diff3 -3 -m $ours $base $theirs > $tmp)
|
if(! ape/diff3 -3 -m $ours $base $theirs > $tmp)
|
||||||
echo merge needed: $out >[1=2]
|
echo merge needed: $out >[1=2]
|
||||||
|
|
||||||
if(present $ours $base $theirs){
|
if(mergeperm $ours $base $theirs){
|
||||||
mv $tmp $out
|
mv $tmp $out
|
||||||
git/add $out
|
git/add $out
|
||||||
|
chmod $mergedperms $out
|
||||||
}
|
}
|
||||||
if not {
|
if not {
|
||||||
rm -f $tmp $out
|
rm -f $tmp $out
|
||||||
|
|
Loading…
Reference in a new issue