HTCondor Project List Archives



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-devel] Merging only the doc/ subtree



I left a couple lines off the end of the script that make the cooperation with
the git tools much smoother; this makes my script below crisp. 

>  - Did a bunch of git merges.  Had to make an inquiry, as I was to
>    merge a whole lot of undesireable code into 7.7.1, since
>    developers had stopped merging through 7.7.1, but the documentation
>    still needed to go through.  This will be a perpetual problem,
>    since last-second documentation needs to be propagated, while
>    code should/must not.

Hi Karen,

Next time this happens, could you try running the following script? (I sent an
earlier version a few weeks ago, but I believe this one takes care of merge
conflicts) This will merge only the changes below doc/.

#! /usr/bin/env bash

# First check that we have no changes to commit
if ! git diff --quiet || ! git diff --cached --quiet; then
	echo "You have uncommitted changes"
	echo "Commit your changes; then run again" 
	exit 1
fi

#Check that we are actually on a branch
if ! git symbolic-ref -q HEAD; then
	echo "You are on a detached HEAD"
	exit 1
fi

#Find the merge base between HEAD and the merge candidate
MB="$(git merge-base HEAD $1)"
if test -z "$MB"; then
# Exit if there is no merge-base
	echo "No merge base; I won't know how to merge"
	exit 1
fi

# Get the tree of the merge base
MT="$(git rev-parse ${MB}^{tree})"

# Get our tree (the one we are sitting on now)
HT="$(git rev-parse HEAD^{tree})";

# Delete doc/ from our index. This does not mess with our working tree!
# Even if it did, we checked above that our working tree is clean and
# everything is committed. (So no data will be lost)
git rm -rf --cached doc/

# Read in the doc tree from the merge candidate
git read-tree --prefix=doc/ ${1}:doc/

# Create a new tree
TT="$(git write-tree)"

# Report on differences we found we should have only one line,  that
# looks like
#
# :040000 040000 8091b82... 6c5be8f... M  doc
#
git diff-tree --abbrev $HT $TT

# This resets our tree
git reset --hard HEAD
git read-tree -u -m $MT $HT $TT
git merge-index -o $(git --exec-path)/git-merge-one-file -a

# This next part is what I left off the last message
# Tell git we are doing a merge
git update-ref MERGE_HEAD $(git rev-parse $1)

# Assert in the commit message that we are doing a doc-only merge
echo "Doing a doc-only merge from '$1'" >> $(git rev-parse --git-dir)/MERGE_MSG

# Now you should be able to resolve conflicts, etc, as after a "normal" merge.