diff options
author | Dan Willemsen <dwillemsen@google.com> | 2015-08-05 14:38:34 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2015-08-05 15:05:50 -0700 |
commit | 48d6e8cf10618a398a85f3728f7a9243b4c57090 (patch) | |
tree | 577c42b703ab141f4c1af42be947dbbc5ab7a7fd /func.cc | |
parent | a06bee9cb929c2e0646154c6803c3c32565ca6eb (diff) | |
download | kati-48d6e8cf10618a398a85f3728f7a9243b4c57090.tar.gz |
[C++] Don't sort find/ls results
These should only be sorted if explicitly requested, otherwise
make-built binaries may be different from kati-built binaries.
This resolves some binary-diff issues for Android between libc.a built
with make vs kati/ninja. To be the same across multiple
checkouts/machines, we should probably switch android to sorting these
results, but then the kati ninja support will stop working.
Diffstat (limited to 'func.cc')
-rw-r--r-- | func.cc | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -476,7 +476,6 @@ static bool HasNoIoInShellScript(const string& cmd) { } static void ShellFuncImpl(const string& shell, const string& cmd, - bool is_file_list_command, string* s, FindCommand** fc) { LOG("ShellFunc: %s", cmd.c_str()); @@ -493,7 +492,6 @@ static void ShellFuncImpl(const string& shell, const string& cmd, } #else if (FindEmulator::Get()->HandleFind(cmd, **fc, s)) { - *s = SortWordsInString(*s); return; } #endif @@ -504,19 +502,13 @@ static void ShellFuncImpl(const string& shell, const string& cmd, COLLECT_STATS_WITH_SLOW_REPORT("func shell time", cmd.c_str()); RunCommand(shell, cmd, RedirectStderr::NONE, s); - if (is_file_list_command) { - *s = SortWordsInString(*s); - } else { - FormatForCommandSubstitution(s); - } + FormatForCommandSubstitution(s); #ifdef TEST_FIND_EMULATOR if (need_check) { - string sorted = SortWordsInString(*s); - out2 = SortWordsInString(out2); - if (sorted != out2) { + if (*s != out2) { ERROR("FindEmulator is broken: %s\n%s\nvs\n%s", - cmd.c_str(), sorted.c_str(), out2.c_str()); + cmd.c_str(), s->c_str(), out2.c_str()); } } #endif @@ -542,7 +534,7 @@ void ShellFunc(const vector<Value*>& args, Evaluator* ev, string* s) { string out; FindCommand* fc = NULL; - ShellFuncImpl(*shell, *cmd, is_file_list_command, &out, &fc); + ShellFuncImpl(*shell, *cmd, &out, &fc); if (is_file_list_command) { FileListCommand* flc = new FileListCommand(); flc->cmd = *cmd; |