From: Junio C Hamano Date: Sun, 15 May 2005 20:27:47 GMT Subject: [RFD] git-run-with-user-path Message-ID: <7vu0l4s08s.fsf_-_@assigned-by-dhcp.cox.net> In-Reply-To: <7v4qd5vxao.fsf@assigned-by-dhcp.cox.net> Petr, I have not written the implementation yet, but do you think Cogito would find something like this useful? I've seen some patch to add running from subdirectory support to cg-add in the mailing list and I assume Cogito is in the process of being enhanced in this area. JIT has been supporting running from the subdirectory from the day one, but has been using a bit different mechanism. If we can agree on a core-ish helper (I consider this just as non-core as git-diff-helper is), I would want to switch to use something like this one. This _deliberately_ conflates the user-path canonicalization with the ignore-list processing discussed recently on the list. When you think about it, they are very closely related and handling them at the same place makes more sense than having them separately. It is a way to munge paths given by users and "find -print0 | xargs -0" into a form appropriate for core GIT consumption. Similar reasoning with which you accepted the use of cg-Xignore by David Greaves in cg-commit. Linus, and everybody else, suggestions and comments? ------------ git-run-with-user-path(1) ========================= v0.1, May 2005 NAME ---- git-run-with-user-path - Run command from the top after canonicalizing paths. SYNOPSIS -------- 'git-run-with-user-path' [options] ... '--' ... DESCRIPTION ----------- This command takes a , zero or more and zero or more arguments. arguments name objects on the filesystem, is typically a core GIT command, and are the initial arguments to the . It first finds the project top directory (the directory that corresponds to the top of the tree structure GIT_INDEX_FILE describes), and canonicalizes the given to be relative to the project top. It then chdir(2)'s to the project top directory and runs the given , with and these canonicalized arguments. This is useful for the Porcelain layer to run core GIT commands from subdirectories. For example, if linux-2.6.git tree is checked out in /usr/src/linux, you can do: $ cd /usr/src/linux/fs $ ... work in fs directory making changes ... $ git-run-with-user-path git-diff-tree -r HEAD -- ext? ../include/linux $ find ext? ! -type d -print0 | xargs -0 git-run-with-user-path git-update-cache --add -- -- The above is roughly equivalent to: $ cd /usr/src/linux $ git-diff-tree -r HEAD fs/ext? include/linux $ find fs/ext? include/linux ! -type d -print0 | xargs git-update-cache --add -- OPTIONS ------- --no-ignore:: By default, the path arguments are filtered with the same ignore rules Porcelain layers use. With --no-ignore flag, there is no such filtering done. Author ------ Written by Junio C Hamano Documentation -------------- Documentation by Junio C Hamano. GIT --- Part of the link:git.html[git] suite