Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Atlassian SourceTree custom action contrast

After checking out a new branch, I wanted to stop tracking of files like .classpath via Atlassian SourceTree (Version 1.4.0.0). I created a custom action with the details below:

enter image description here

Then, from the "Working Copy changes" panel, I selected a file, right-clicked on it and tried to execute "assume unchanged" custom command. However, I got this totally "scrimpy" error message:

enter image description here

I copied the full command in the error message above and tried to execute it from the command line:enter image description here

Interestingly, it worked.

Can someone tell me why this custom action didn't work at first place via right clicking and selecting from the menu?

like image 885
Juvanis Avatar asked Oct 31 '22 20:10

Juvanis


1 Answers

This is interesting. I just noticed this issue on my own setup when a previously working git-based command now no longer worked. I assume something has changed in the more recent version of SourceTree. I believe the issue is now invoked commands won't get the complete environment setup configured just as one might expect when opening a terminal from SourceTree. The Completed with errors message is a result of the command not being found.

For my own setup, I work around this issue by building my custom actions with the cmd process. For example:

  • Caption: Full Index Patch for Selected Commit
  • Script to run: cmd

With parameters:

/c %LOCALAPPDATA%\Atlassian\SourceTree\git_local\bin\sh.exe --login -i -c 'git format-patch --full-index -1 $SHA'

Another example:

  • Caption: Full Index Patch for Working Index
  • Script to run: cmd

With parameters:

/c %LOCALAPPDATA%\Atlassian\SourceTree\git_local\bin\sh.exe --login -i -c ^"git diff --full-index --cached > patch.diff^"

(these examples assume you're using the embedded Git in SourceTree)

Using SourceTree 1.6.12 and Git 1.8.3.

like image 93
jdknight Avatar answered Nov 11 '22 17:11

jdknight