{"thread":{"id":"2601","subject":"git --exec-path conversion","startedAt":"2005-11-19T11:14:44Z","lastAt":"2005-11-19T12:05:12Z","messageCount":4,"participants":["Marco Costalba","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"12318","messageId":"20051119111444.82122.qmail@web26309.mail.ukl.yahoo.com","threadId":"2601","inReplyTo":null,"subject":"git --exec-path conversion","fromName":"Marco Costalba","fromEmail":"mcostalba@yahoo.it","sentAt":"2005-11-19T11:14:44Z","receivedAt":"2005-11-19T11:14:44Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"Hi,\n\n   if I understood correctly, git programs will be installed somewhere in $PATH for at least next\ntwo months.\n\nBut I would like to update to what will be the future, i.e. prepending what 'git --exec-path' says\nto any git command.\n\nI don't call git programs directly but I use a function QGit::run(cmd) that does this plus other\nthings.\n\nThe problem is that I call QGit::run() also for other commands not related to git (ls, cat,\netc..).\n\nHow can I make the transition?\n\nNow I have two ways, the brute force way and the easy (peraphs tricky) way.\n\nThe brute force is to create a new function QGit::runGitCmd() that deals only with git commands\n_and_ replace all the occurences of run() with the latter.\n\nThe easy way is to prepend the exec-path *inside* run(), and to use to disambiguate bewteen git\nand shell commands the testing of first three chars of the command to launch, something like:\n\n    if (cmd.left(3) == \"git\") \n         cmd = cmd.prepend(exec-path);\n\n\nI would like to go with the second one, I'm a bit lazy ;-) , but I would like to ask if this is a\ngood policy, i.e. if also inside git programs/scripts (like in git.c I guess) is used or is\nforeseen to keep using something like this.\n\n\nThanks\nMarco\n\n\n__________________________________________________\nDo You Yahoo!?\nTired of spam?  Yahoo! Mail has the best spam protection around \nhttp://mail.yahoo.com \n"},{"id":"12319","messageId":"Pine.LNX.4.63.0511191218370.27986@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2601","inReplyTo":"20051119111444.82122.qmail@web26309.mail.ukl.yahoo.com","subject":"Re: git --exec-path conversion","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-19T11:20:26Z","receivedAt":"2005-11-19T11:20:26Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 19 Nov 2005, Marco Costalba wrote:\n\n>     if (cmd.left(3) == \"git\") \n>          cmd = cmd.prepend(exec-path);\n\nLittle nit: Test for \"git-\", because \"git\" and \"gitk\" will stay in the \nPATH.\n\nCiao,\nDscho\n"},{"id":"12322","messageId":"7vy83k6dyf.fsf@assigned-by-dhcp.cox.net","threadId":"2601","inReplyTo":"20051119111444.82122.qmail@web26309.mail.ukl.yahoo.com","subject":"Re: git --exec-path conversion","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-19T12:04:40Z","receivedAt":"2005-11-19T12:04:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@yahoo.it> writes:\n\n> if I understood correctly, git programs will be installed\n> somewhere in $PATH for at least next two months.\n\nI suspect things will stay in /usr/bin longer than that, but\nfutureproofing is good in any case.\n\nAssuming you are writing things in C or C++:\n\n - run \"git --exec-path\" at the very beginning of main(),\n - read the output, prepend it to $PATH using setenv(3).\n\nand I think you are done.  After this, your QGit::run(\"ls\") and\nQGit::run(\"git frotz\") would not be affected (you still have\n/usr/bin in your $PATH), and QGIT::run(\"git-frotz\") would find\ngit-frotz installed somewhere outside /usr/bin.\n"},{"id":"12321","messageId":"7vu0e86dxj.fsf@assigned-by-dhcp.cox.net","threadId":"2601","inReplyTo":"Pine.LNX.4.63.0511191218370.27986@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git --exec-path conversion","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-19T12:05:12Z","receivedAt":"2005-11-19T12:05:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Little nit: Test for \"git-\", because \"git\" and \"gitk\" will stay in the \n> PATH.\n\nHeh, he is writing QGit; why should he run gitk ;-)?\n"}]}