summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Bram <Bram@web>2014-10-14 10:11:04 +0000
committerGravatar admin <admin@branchable.com>2014-10-14 10:11:04 +0000
commita4d38ceadf6769759991e063853eed81ff25a5aa (patch)
tree44d587b58dc18e8a258846c34bbba0d41dcbe613
parent76191b05a64f2381e58bf368493c92bbefe7bb22 (diff)
Added a comment: Diff of unlocked file
-rw-r--r--doc/todo/wishlist:_git_annex_diff/comment_2_2e8324f47b66dce385263e258e94da16._comment32
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/todo/wishlist:_git_annex_diff/comment_2_2e8324f47b66dce385263e258e94da16._comment b/doc/todo/wishlist:_git_annex_diff/comment_2_2e8324f47b66dce385263e258e94da16._comment
new file mode 100644
index 000000000..83501b791
--- /dev/null
+++ b/doc/todo/wishlist:_git_annex_diff/comment_2_2e8324f47b66dce385263e258e94da16._comment
@@ -0,0 +1,32 @@
+[[!comment format=mdwn
+ username="Bram"
+ ip="81.20.68.186"
+ subject="Diff of unlocked file"
+ date="2014-10-14T10:11:04Z"
+ content="""
+I wrote a little shell script that implements part of this request. It shows the diff between an unlocked file and its locked version (i.e. the current edits that have not yet been annexed).
+This only works in non-direct mode, and obviously with 'diffable' content only.
+
+Usage is simple, the only parameter it requires is the unlocked filename.
+
+ #!/bin/bash
+
+ DIFF=\"diff\"
+ FILE=\"$1\"
+ KEY=$(git annex lookupkey \"$FILE\")
+
+ GITPATH=\"$(git rev-parse --show-toplevel)/.git\"
+ ANNEXPATH=$GITPATH/annex/objects/$(git annex examinekey --format='${hashdirmixed}${key}/${key}' \"$KEY\")
+
+ if [ -L \"$FILE\" ]; then
+ echo \"$FILE is not unlocked.\" > /dev/stderr
+ else
+ if [ -r \"$ANNEXPATH\" ]; then
+ $DIFF \"$ANNEXPATH\" \"$FILE\"
+ else
+ echo \"Cannot find $ANNEXPATH\" > /dev/stderr
+ exit 1
+ fi
+ exit 1
+ fi
+"""]]